aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-23 17:47:17 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-23 17:47:17 +0200
commitba84c0d82066739adbca468846a2688e02432b6f (patch)
tree013310fce724e165b63bb122c379b0c72d5aad3b
parent981e192d2ed0cc3772f8ba8107a4cfc8dc33d214 (diff)
downloadcerrado-ba84c0d82066739adbca468846a2688e02432b6f.tar.gz
cerrado-ba84c0d82066739adbca468846a2688e02432b6f.tar.bz2
cerrado-ba84c0d82066739adbca468846a2688e02432b6f.zip
fix: Handle about file not found
-rw-r--r--pkg/handler/git/handler.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go
index 4c5d198..0963033 100644
--- a/pkg/handler/git/handler.go
+++ b/pkg/handler/git/handler.go
@@ -2,6 +2,7 @@ package git
import (
"bytes"
+ "errors"
"fmt"
"io"
"log/slog"
@@ -160,6 +161,16 @@ func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) error {
}
file, err := g.gitService.GetAbout(name)
+ if errors.Is(err, object.ErrFileNotFound) {
+ templates.WritePageTemplate(w, &templates.GitItemPage{
+ Name: name,
+ Ref: ref.Name().Short(),
+ GitItemBase: &templates.GitItemAboutPage{
+ About: []byte("About file not configured properly"),
+ },
+ })
+ return nil
+ }
if err != nil {
return err
}