420 Star 1.9K Fork 709

进击的皇虫 / DocHub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
StaticController.go 601 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2019-04-03 23:22 . 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)
}
Go
1
https://gitee.com/truthhun/DocHub.git
git@gitee.com:truthhun/DocHub.git
truthhun
DocHub
DocHub
01033d1926ec

搜索帮助