From ca8e7b9475fffd0ba435b0aaed19c24b316aab10 Mon Sep 17 00:00:00 2001 From: 954437801 <118098732+954437801@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A3=80=E6=9F=A5accept-ranges=E5=A4=B4=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E4=B8=BAbytes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检查返回内容,accept-ranges头,如果为bytes,则表示支持断点续传,是静态资源 --- utils/http_check.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/http_check.go b/utils/http_check.go index 1ecd245..911ab74 100644 --- a/utils/http_check.go +++ b/utils/http_check.go @@ -177,6 +177,11 @@ func IsStaticAssist(res *http.Response, contentType string) bool { zlog.Debug(fmt.Sprintf("检测到附件 %s", res.Request.URL.String())) return true } + // 检查返回内容,accept-ranges头,如果为bytes,则表示支持断点续传,是静态资源 + acceptRanges := res.Header.Get("Accept-Ranges") + if acceptRanges == "bytes" { + return true + } // 检查请求的Accept头,判断是否为资源类型请求 if res.Request != nil { // 检查Sec-Fetch-Dest头,这是一个更明确的指示