0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-21 13:26:24 -05:00
forgejo/routers/api/v1/repo
Giteabot 4dccac3dbf
Fix api error message if fork exists (#24487) (#24493)
Backport #24487 by @fnetX

On the @Forgejo instance of Codeberg, we discovered that forking a repo
which is already forked now returns a 500 Internal Server Error, which
is unexpected. This is an attempt at fixing this.

The error message in the log:
~~~
2023/05/02 08:36:30 .../api/v1/repo/fork.go:147:CreateFork() [E]
[6450cb8e-113] ForkRepository: repository is already forked by user
[uname: ...., repo path: .../..., fork path: .../...]
~~~

The service that is used for forking returns a custom error message
which is not checked against.

About the order of options:
The case that the fork already exists should be more common, followed by
the case that a repo with the same name already exists for other
reasons. The case that the global repo limit is hit is probably not the
likeliest.

---------

Co-authored-by: Otto Richter (fnetX) <git@fralix.ovh>
2023-05-03 08:15:56 -04:00
..
blob.go
branch.go Fix protected branch for API (#24013) (#24027) 2023-04-10 14:48:02 +08:00
collaborators.go
commits.go
file.go
fork.go Fix api error message if fork exists (#24487) (#24493) 2023-05-03 08:15:56 -04:00
git_hook.go
git_ref.go
hook.go
hook_test.go
issue.go
issue_attachment.go Preserve file size when creating attachments (#23406) (#23426) 2023-03-12 12:45:39 +01:00
issue_comment.go Fix issue attachment handling (#24202) (#24221) 2023-04-20 04:21:10 -04:00
issue_comment_attachment.go Preserve file size when creating attachments (#23406) (#23426) 2023-03-12 12:45:39 +01:00
issue_label.go
issue_reaction.go
issue_stopwatch.go
issue_subscription.go
issue_tracked_time.go
key.go
label.go Add loading yaml label template files (#22976) (#23232) 2023-03-01 21:57:34 -05:00
language.go
main_test.go
migrate.go Match api migration behavior to web behavior (#23552) (#23573) 2023-03-19 15:30:02 +08:00
milestone.go
mirror.go
notes.go Fix panic when getting notes by ref (#23372) (#23377) 2023-03-08 15:17:31 -05:00
patch.go
pull.go Add force_merge to merge request and fix checking mergable (#23010) 2023-02-21 08:42:07 -06:00
pull_review.go
release.go
release_attachment.go Preserve file size when creating attachments (#23406) (#23426) 2023-03-12 12:45:39 +01:00
release_tags.go
repo.go Handle missing README in create repos API (#23387) (#23510) 2023-03-16 21:04:52 -04:00
repo_test.go
star.go
status.go
subscriber.go
tag.go
teams.go
topic.go
transfer.go
tree.go
wiki.go