1 Star 0 Fork 720

兴博软件/DocHub

forked from 进击的皇虫/DocHub 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
StaticController.go 601 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2019-04-03 23:22 +08:00 . SVG压缩优化
package HomeControllers
import (
"net/http"
"path/filepath"
"strings"
"github.com/TruthHun/DocHub/helper"
"github.com/astaxie/beego"
)
type StaticController struct {
beego.Controller
}
// 将除了static之外的静态资源导向到虚拟根目录
func (this *StaticController) Static() {
splat := strings.TrimPrefix(this.GetString(":splat"), "../")
if strings.HasPrefix(splat, ".well-known") {
http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, splat)
return
}
path := filepath.Join(helper.RootPath, splat)
http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, path)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lalbe/DocHub.git
git@gitee.com:lalbe/DocHub.git
lalbe
DocHub
DocHub
dd28a31bcdb3

搜索帮助