all repos — elgit @ fed19ae329323cca0f7b49624486966fbce8096b

fork of legit: web frontend for git, written in go

use gitweb/gitolite directory layout (including subdirs)

Alan Pearce
commit

fed19ae329323cca0f7b49624486966fbce8096b

parent

9c336ff148d48d09a4f4866798511cdcce50202a

1 file changed, 9 insertions(+), 12 deletions(-)

changed files
M routes/git.goroutes/git.go
@@ -5,19 +5,17 @@ "compress/gzip"
"io" "log" "net/http" - "path/filepath" + "path" - securejoin "github.com/cyphar/filepath-securejoin" "go.alanpearce.eu/elgit/git/service" ) -func (d *deps) InfoRefs(w http.ResponseWriter, r *http.Request) { - name := r.PathValue("name") - name = filepath.Clean(name) +func (d *deps) InfoRefs(w http.ResponseWriter, r *http.Request, params map[string]string) { + name := path.Join(params["category"], params["name"]) - repo, err := securejoin.SecureJoin(d.c.Repo.ScanPath, name) + repo, err := d.GetCleanPath(name) if err != nil { - log.Printf("securejoin error: %v", err) + log.Printf("getcleanpath error: %v", err) d.Write404(w) return }
@@ -37,13 +35,12 @@ return
} } -func (d *deps) UploadPack(w http.ResponseWriter, r *http.Request) { - name := r.PathValue("name") - name = filepath.Clean(name) +func (d *deps) UploadPack(w http.ResponseWriter, r *http.Request, params map[string]string) { + name := path.Join(params["category"], params["name"]) - repo, err := securejoin.SecureJoin(d.c.Repo.ScanPath, name) + repo, err := d.GetCleanPath(name) if err != nil { - log.Printf("securejoin error: %v", err) + log.Printf("getcleanpath error: %v", err) d.Write404(w) return }