summaryrefslogtreecommitdiff
path: root/src/edit/dir.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-11-02 16:09:45 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-11-02 16:09:45 -0400
commitade49d8845e044292da64fcbe72a1f7ee91e66d9 (patch)
treeb2030f99f28b1d9366989df3d74da5d874d6dbd9 /src/edit/dir.go
parent60632ea541ac6fc57c8158bf44c625c526e1b215 (diff)
some views
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 + "/"
+ }
}
}