fix(handles): check whether is a download or preview link

delete binary file
pull/8540/head
Stephen Zeng 2025-05-18 23:21:17 +08:00
parent dd5c564918
commit 9e662e6b57
1 changed files with 2 additions and 1 deletions

View File

@ -130,7 +130,8 @@ func localProxy(c *gin.Context, link *model.Link, file model.Obj, proxyRange boo
}
Writer := &common.WrittenResponseWriter{ResponseWriter: c.Writer}
if strings.EqualFold(file.GetName(), "README.md") && setting.GetBool(conf.FilterReadMeScripts) {
absPath := c.Request.URL.String()
if absPath[1] == 'p' && utils.Ext(file.GetName()) == "md" && setting.GetBool(conf.FilterReadMeScripts) {
buf := bytes.NewBuffer(make([]byte, 0, file.GetSize()))
w := &common.InterceptResponseWriter{ResponseWriter: Writer, Writer: buf}
err = common.Proxy(w, c.Request, link, file)