Prevent addition of duplicate path prefixes.
I think I understand this now; the failure comes from here: https://golang.org/src/cmd/go/vcs.go#L818 and makes it so one can't both host: - github.com/foo - github.com/foo/bar which would have to clone the latter inside of the former. Fixes #1.
This commit is contained in:
@@ -31,6 +31,10 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
p.Path = fmt.Sprintf("%s/%s", s.hostname, strings.Trim(req.URL.Path, "/"))
|
||||
if !Valid(p.Path, s.storage.All()) {
|
||||
http.Error(w, fmt.Sprintf("invalid path; prefix already taken %q", req.URL.Path), http.StatusConflict)
|
||||
return
|
||||
}
|
||||
s.storage.Add(p)
|
||||
case "PATCH":
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user