sketch/loop: return 204 for not-found files in /git/cat
This isn't actually an error; no reason to return a 500.
The front-end handles this identically,
but without js console log spam,
which is the motivation for this change.
diff --git a/loop/server/loophttp.go b/loop/server/loophttp.go
index e223a60..8a65b4c 100644
--- a/loop/server/loophttp.go
+++ b/loop/server/loophttp.go
@@ -7,6 +7,7 @@
"encoding/base64"
"encoding/hex"
"encoding/json"
+ "errors"
"fmt"
"html"
"io"
@@ -1440,6 +1441,10 @@
// Get file content using GitCat
content, err := git_tools.GitCat(repoDir, path)
+ if errors.Is(err, os.ErrNotExist) {
+ w.WriteHeader(http.StatusNoContent)
+ return
+ }
if err != nil {
http.Error(w, fmt.Sprintf("Error reading file: %v", err), http.StatusInternalServerError)
return