From ba84c0d82066739adbca468846a2688e02432b6f Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 23 Jun 2024 17:47:17 +0200 Subject: fix: Handle about file not found --- pkg/handler/git/handler.go | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 } -- cgit v1.2.3