diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:47:17 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:47:17 +0200 |
commit | ba84c0d82066739adbca468846a2688e02432b6f (patch) | |
tree | 013310fce724e165b63bb122c379b0c72d5aad3b /pkg | |
parent | 981e192d2ed0cc3772f8ba8107a4cfc8dc33d214 (diff) | |
download | cerrado-ba84c0d82066739adbca468846a2688e02432b6f.tar.gz cerrado-ba84c0d82066739adbca468846a2688e02432b6f.tar.bz2 cerrado-ba84c0d82066739adbca468846a2688e02432b6f.zip |
fix: Handle about file not found
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/handler/git/handler.go | 11 |
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 } |