fix(server): can't edit .md source files (#1159)

* fix(server): can't edit .md source files

* chore

* add ignore direct link args
This commit is contained in:
hshpy
2025-08-28 16:19:57 +08:00
committed by GitHub
parent bbd4389345
commit 04a5e58781
2 changed files with 3 additions and 4 deletions

View File

@ -114,9 +114,8 @@ func proxy(c *gin.Context, link *model.Link, file model.Obj, proxyRange bool) {
link = common.ProxyRange(c, link, file.GetSize())
}
Writer := &common.WrittenResponseWriter{ResponseWriter: c.Writer}
//优先处理md文件
if utils.Ext(file.GetName()) == "md" && setting.GetBool(conf.FilterReadMeScripts) {
raw, _ := strconv.ParseBool(c.DefaultQuery("raw", "false"))
if utils.Ext(file.GetName()) == "md" && setting.GetBool(conf.FilterReadMeScripts) && !raw {
buf := bytes.NewBuffer(make([]byte, 0, file.GetSize()))
w := &common.InterceptResponseWriter{ResponseWriter: Writer, Writer: buf}
err = common.Proxy(w, c.Request, link, file)