Fix dir not found handling (#5533)

This commit is contained in:
qwerty287
2025-09-21 12:11:35 +02:00
committed by GitHub
parent 41753866df
commit 6d5bb97b40
2 changed files with 8 additions and 2 deletions

View File

@@ -286,8 +286,11 @@ func (c *Forgejo) Dir(ctx context.Context, u *model.User, r *model.Repo, b *mode
}
// List files in repository
contents, _, err := client.ListContents(r.Owner, r.Name, b.Commit, f)
contents, resp, err := client.ListContents(r.Owner, r.Name, b.Commit, f)
if err != nil {
if resp != nil && resp.StatusCode == http.StatusNotFound {
return nil, errors.Join(err, &forge_types.ErrConfigNotFound{Configs: []string{f}})
}
return nil, err
}

View File

@@ -288,8 +288,11 @@ func (c *Gitea) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.
}
// List files in repository
contents, _, err := client.ListContents(r.Owner, r.Name, b.Commit, f)
contents, resp, err := client.ListContents(r.Owner, r.Name, b.Commit, f)
if err != nil {
if resp != nil && resp.StatusCode == http.StatusNotFound {
return nil, errors.Join(err, &forge_types.ErrConfigNotFound{Configs: []string{f}})
}
return nil, err
}