From a1e8e3e3731459872781a1b44989abeb933300e8 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Fri, 14 Feb 2025 07:20:34 +0800 Subject: [PATCH] add 404 HTTP Error Handling --- proxy/chunkreq.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/chunkreq.go b/proxy/chunkreq.go index f1fb693..e1279b2 100644 --- a/proxy/chunkreq.go +++ b/proxy/chunkreq.go @@ -132,6 +132,12 @@ func ChunkedProxyRequest(c *gin.Context, u string, cfg *config.Config, mode stri } */ + // 错误处理(404) + if resp.StatusCode == 404 { + c.String(http.StatusNotFound, "File Not Found") + return + } + contentLength = resp.Header.Get("Content-Length") if contentLength != "" { size, err := strconv.Atoi(contentLength)