add 404 HTTP Error Handling

This commit is contained in:
WJQSERVER 2025-02-14 07:20:34 +08:00
parent 40c9ca5f38
commit a1e8e3e373

View file

@ -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)