This commit is contained in:
Liang Ding 2022-10-28 08:39:20 +08:00
parent 1809c27f60
commit 0bc997051e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 4 additions and 2 deletions

View file

@ -41,7 +41,7 @@ func serveSnippets(c *gin.Context) {
c.Status(404)
return
}
for _, s := range confSnippets {
if s.Name == name && ("" != ext && s.Type == ext[1:]) {
c.Header("Content-Type", mime.TypeByExtension(ext))
@ -49,6 +49,8 @@ func serveSnippets(c *gin.Context) {
return
}
}
// 没有在配置文件中命中时在文件系统上查找
filePath = filepath.Join(util.SnippetsPath, filePath)
c.File(filePath)
}