Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v10.0/forgejo] fix: return 404 for empty repositories (#7014)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/7003 Some endpoints (`/api/v1/repos/*/*/raw`, `/api/v1/repos/*/*/media`, ...; anything that uses both `context.ReferencesGitRepo()` and `context.RepoRefForAPI` really) returned a 500 when the repository was completely empty. This resulted in some confusion in datalad/datalad-usage-dashboard#47 because the same request for a non-existent file in a repository could sometimes generate a 404 and sometimes a 500, depending on if the git repository is initialized at all or not. Returning a 404 seems more appropriate here, since this isn't an unexpected internal error, but just another way of not finding the requested data. Co-authored-by: Matthias Riße <[email protected]> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7014 Reviewed-by: Gusted <[email protected]> Co-authored-by: forgejo-backport-action <[email protected]> Co-committed-by: forgejo-backport-action <[email protected]>
- Loading branch information