forgejo/models/repo
Gusted 389b32f51a feat: make upload URL compatible with GitHub API (#9285)
Adds new a function, `AcceptsGithubResponse`, to the API router context struct to check if the requests accepts a Github response. Although Forgejo API will never be compatible with the Github API, historically Forgejo's API has been designed to follow that of Github closely and we know that a lot of tooling that uses the Github API can be used against the Forgejo API with little to no problem.

As a meet in the middle solution, this function can be used to respond with a more appropriate response that follows the Github API. This allows Forgejo to avoid breaking compatibility with existing users of the API and allows the API to be oh so slightly more compatible with that of Github for API clients that expect a Github response.

Because the `upload_url` field was added purely to match the Github API (forgejo/forgejo#580), it is fair to actually make it compatible with how the Github API intended it to be and that is by adding `{?name,label}` which is used by Github's Oktokit.

Only add `{?name,label}` when Forgejo knows the request accepts a Github response. This avoids breaking the API compatibility with non-Github API  clients.

Resolves Codeberg/Community#2132

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9285
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-09-15 15:53:35 +02:00
..
TestSearchRepositoryIDsByCondition
archive_download_count.go
archive_download_count_test.go
archiver.go
attachment.go
attachment_test.go
avatar.go
collaboration.go
collaboration_test.go
following_repo.go
following_repo_test.go
fork.go
fork_test.go
git.go feat: introduce global merge message templates (#8347) 2025-07-12 16:00:42 +02:00
issue.go
language_stats.go
language_stats_test.go
main_test.go
mirror.go
moderation.go feat: Admin interface for abuse reports (#7905) 2025-07-23 00:20:15 +02:00
moderation_test.go feat: Admin interface for abuse reports (#7905) 2025-07-23 00:20:15 +02:00
pushmirror.go
pushmirror_test.go
redirect.go fix: do permission check for repository redirect 2025-08-30 09:37:34 +02:00
redirect_test.go fix: do permission check for repository redirect 2025-08-30 09:37:34 +02:00
release.go feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
release_list.go
release_list_test.go
release_test.go feat: add tag label to commit list view (#8759) 2025-08-06 14:47:51 +02:00
repo.go
repo_flags.go
repo_flags_test.go
repo_indexer.go
repo_list.go
repo_list_test.go
repo_repository.go fix: assorted ActivityPub code only refactors (#8708) 2025-07-28 15:17:29 +02:00
repo_test.go
repo_unit.go fix: a corrupted Forgejo Actions scheduled workflow is disabled (#8942) 2025-08-18 22:45:10 +02:00
repo_unit_test.go
search.go
star.go
star_test.go
topic.go chore(api): update swagger method descripitons (#8728) 2025-07-30 18:08:28 +02:00
topic_test.go
update.go
upload.go
user_repo.go
user_repo_test.go
watch.go
watch_test.go
wiki.go
wiki_test.go