diff --git a/gitea/client.go b/gitea/client.go index 7bed748..575b5bd 100644 --- a/gitea/client.go +++ b/gitea/client.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "strings" ) @@ -224,7 +225,8 @@ func (c *Client) GetAllFilesInPath(ctx context.Context, owner, repo, path string case "file": content, err := c.GetFileContent(ctx, owner, repo, entry.Path) if err != nil { - continue // Skip files we can't read + log.Printf("Warning: could not fetch file %s: %v", entry.Path, err) + continue } results[entry.Path] = content case "dir": diff --git a/integration_test.go b/integration_test.go index 948c301..d0b9055 100644 --- a/integration_test.go +++ b/integration_test.go @@ -6,6 +6,7 @@ import ( "context" "os" "strconv" + "strings" "testing" "gitea.weiker.me/rodin/review-bot/gitea" @@ -43,14 +44,11 @@ func TestIntegration_FullReviewFlow(t *testing.T) { } // Parse owner/repo - owner, repoName := "", "" - for i, c := range giteaRepo { - if c == '/' { - owner = giteaRepo[:i] - repoName = giteaRepo[i+1:] - break - } + parts := strings.SplitN(giteaRepo, "/", 2) + if len(parts) != 2 { + t.Fatalf("Invalid repo format %q", giteaRepo) } + owner, repoName := parts[0], parts[1] if owner == "" || repoName == "" { t.Fatalf("Invalid repo format %q", giteaRepo) }