MCPcopy Create free account
hub / github.com/TruthHun/BookStack / StaticFile

Method StaticFile

controllers/StaticController.go:66–76  ·  view source on GitHub ↗

静态文件,这个加在路由的最后

()

Source from the content-addressed store, hash-verified

64
65// 静态文件,这个加在路由的最后
66func (this *StaticController) StaticFile() {
67 file := this.GetString(":splat")
68 if strings.HasPrefix(file, ".well-known") || file == "sitemap.xml" {
69 http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, file)
70 return
71 }
72
73 file = strings.ReplaceAll(strings.TrimLeft(file, "./"), "\\", "/")
74 path := filepath.Join(utils.VirtualRoot, file)
75 http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, path)
76}
77
78// ProjectsFile 书籍静态文件
79func (this *StaticController) ProjectsFile() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected