summaryrefslogtreecommitdiff
path: root/src/edit/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit/dir.go')
-rw-r--r--src/edit/dir.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/edit/dir.go b/src/edit/dir.go
index cc99774..b9fa170 100644
--- a/src/edit/dir.go
+++ b/src/edit/dir.go
@@ -17,7 +17,6 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
upath = "/" + upath
}
upath = path.Clean(upath)
- upath = upath[1:]
errcheck(GitPull())
tree, err := GitLsTree()
@@ -28,10 +27,15 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
http.NotFound(out, in)
return
}
- if file.Type == "tree" && !strings.HasSuffix(in.URL.Path, "/") {
+ if file.Type == "tree" {
+ if !strings.HasSuffix(in.URL.Path, "/") {
out.Header().Set("Location", path.Base(upath)+"/")
out.WriteHeader(http.StatusMovedPermanently)
- return
+ return
+ }
+ if !strings.HasSuffix(upath, "/") {
+ upath = upath + "/"
+ }
}
}