mirror of
1
Fork 0
forgejo/tests
forgejo-backport-action 3eacbfead9 [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
https://github.com/datalad/datalad-usage-dashboard/issues/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 <m.risse@fz-juelich.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7014
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2025-02-20 22:26:30 +00:00
..
e2e [v10.0/forgejo] fix(ui): hide extra PR property labels on title edit (#6905) 2025-02-12 09:05:43 +00:00
fuzz
gitea-lfs-meta
gitea-repositories-meta [v10.0/forgejo] chore: remove illegal git usage (#6492) 2025-01-07 19:01:32 +00:00
integration [v10.0/forgejo] fix: return 404 for empty repositories (#7014) 2025-02-20 22:26:30 +00:00
testdata/data Add artifacts test fixture (#30300) 2024-11-05 09:33:15 +01:00
mysql.ini.tmpl chore: improve slow tests 2024-11-14 12:41:11 +01:00
pgsql.ini.tmpl chore: improve slow tests 2024-11-14 12:41:11 +01:00
sqlite.ini.tmpl test: use memory for integration and journal for migration 2024-11-14 15:38:06 +01:00
test_utils.go chore: fix e2e 2024-11-15 14:02:16 +01:00