aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorFlorian Kaiser <florian.kaiser@fnkr.net>2016-02-02 14:09:47 +0000
committerFlorian Kaiser <florian.kaiser@fnkr.net>2016-02-02 14:09:47 +0000
commit0e4ae27caaf729d5ba748559329586f7fb063e70 (patch)
tree809f76bbb5ef3a91957ff53bcae04a908287d20b /routers
parent1c74612b3c025282d4731880575922c797813ca7 (diff)
downloadgitea-0e4ae27caaf729d5ba748559329586f7fb063e70.tar.gz
gitea-0e4ae27caaf729d5ba748559329586f7fb063e70.zip
Use pretty 404 pages in repo.HTTPBackend
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/http.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index e6726936ed..5e81e73cec 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -215,7 +215,7 @@ func HTTP(ctx *middleware.Context) {
}
}
- HTTPBackend(&Config{
+ HTTPBackend(ctx, &Config{
RepoRootPath: setting.RepoRootPath,
GitBinPath: "git",
UploadPack: true,
@@ -286,7 +286,7 @@ func getGitDir(config *Config, fPath string) (string, error) {
}
// Request handling function
-func HTTPBackend(config *Config) http.HandlerFunc {
+func HTTPBackend(ctx *middleware.Context, config *Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
for _, route := range routes {
r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name
@@ -300,7 +300,7 @@ func HTTPBackend(config *Config) http.HandlerFunc {
dir, err := getGitDir(config, m[1])
if err != nil {
log.GitLogger.Error(4, err.Error())
- renderNotFound(w)
+ ctx.Handle(404, "HTTPBackend", err)
return
}
@@ -309,7 +309,7 @@ func HTTPBackend(config *Config) http.HandlerFunc {
}
}
- renderNotFound(w)
+ ctx.Handle(404, "HTTPBackend", nil)
return
}
}
@@ -433,8 +433,6 @@ func sendFile(contentType string, hr handler) {
w, r := hr.w, hr.r
reqFile := path.Join(hr.Dir, hr.File)
- // fmt.Println("sendFile:", reqFile)
-
f, err := os.Stat(reqFile)
if os.IsNotExist(err) {
renderNotFound(w)