diff --git a/src/manifest.go b/src/manifest.go index 2edc612..5cdf3b5 100644 --- a/src/manifest.go +++ b/src/manifest.go @@ -40,7 +40,7 @@ func CompareManifest(left *Manifest, right *Manifest) bool { if leftEntry.GetType() != rightEntry.GetType() { return false } - if bytes.Compare(leftEntry.Data, rightEntry.Data) != 0 { + if !bytes.Equal(leftEntry.Data, rightEntry.Data) { return false } } @@ -74,7 +74,7 @@ func ManifestDebugJSON(manifest *Manifest) []byte { const maxSymlinkLevels int = 128 -var symlinkLoop = errors.New("symbolic link loop") +var errSymlinkLoop = errors.New("symbolic link loop") func ExpandSymlinks(manifest *Manifest, inPath string) (string, error) { var levels int @@ -98,7 +98,7 @@ again: if levels < maxSymlinkLevels { return inPath, nil } else { - return "", symlinkLoop + return "", errSymlinkLoop } } diff --git a/src/pages.go b/src/pages.go index 6aac20a..99e6cda 100644 --- a/src/pages.go +++ b/src/pages.go @@ -160,26 +160,6 @@ func getPage(w http.ResponseWriter, r *http.Request) error { return nil } -func getProjectName(w http.ResponseWriter, r *http.Request) (string, error) { - // path must be either `/` or `/foo/` (`/foo` is accepted as an alias) - path, _ := strings.CutPrefix(r.URL.Path, "/") - path, _ = strings.CutSuffix(path, "/") - if strings.HasPrefix(path, ".") { - http.Error(w, "this directory name is reserved for system use", http.StatusBadRequest) - return "", fmt.Errorf("reserved name") - } else if strings.Contains(path, "/") { - http.Error(w, "only one level of nesting is allowed", http.StatusBadRequest) - return "", fmt.Errorf("nesting too deep") - } - - if path == "" { - // path `/` corresponds to pseudo-project `.index` - return ".index", nil - } else { - return path, nil - } -} - func putPage(w http.ResponseWriter, r *http.Request) error { auth, err := AuthorizeUpdate(r) if err != nil {