You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/routers/web/repo
Jason Song acd7053e9d
Avoid returning without written ctx when posting PR (#31843)
Fix #31625.

If `pull_service.NewPullRequest` return an error which misses each `if`
check, `CompareAndPullRequestPost` will return immediately, since it
doesn't write the HTTP response, a 200 response with empty body will be
sent to clients.

```go
	if err := pull_service.NewPullRequest(ctx, repo, pullIssue, labelIDs, attachments, pullRequest, assigneeIDs); err != nil {
		if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
			ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
		} else if git.IsErrPushRejected(err) {
			// ...
			ctx.JSONError(flashError)
		} else if errors.Is(err, user_model.ErrBlockedUser) {
			// ...
			ctx.JSONError(flashError)
		} else if errors.Is(err, issues_model.ErrMustCollaborator) {
			// ...
			ctx.JSONError(flashError)
		}
		return
	}
```

Not sure what kind of error can cause it to happen, so this PR just
expose it. And we can fix it when users report that creating PRs failed
with error responses.

It's all my guess since I cannot reproduce the problem, but even if it's
not related, the code here needs to be improved.
6 months ago
..
actions Show latest run when visit /run/latest (#31808) 7 months ago
setting Show lock owner instead of repo owner on LFS setting page (#31788) 6 months ago
activity.go Refactor names (#31405) 8 months ago
attachment.go Refactor names (#31405) 8 months ago
blame.go Improve detecting empty files (#31332) 8 months ago
branch.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 7 months ago
cherry_pick.go Refactor names (#31405) 8 months ago
code_frequency.go Move context from modules to services (#29440) 1 year ago
commit.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 7 months ago
compare.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 7 months ago
contributors.go Fix Activity Page Contributors dropdown (#31264) 9 months ago
download.go Refactor names (#31405) 8 months ago
editor.go Add missed return after `ctx.ServerError` (#31130) 9 months ago
editor_test.go Refactor names (#31405) 8 months ago
find.go Refactor names (#31405) 8 months ago
fork.go Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995) 11 months ago
githttp.go Refactor names (#31405) 8 months ago
githttp_test.go
helper.go Move context from modules to services (#29440) 1 year ago
helper_test.go
issue.go Support issue template assignees (#31083) 6 months ago
issue_content_history.go Remove unnecessary inline style for tab-size (#31224) 9 months ago
issue_dependency.go Refactor names (#31405) 8 months ago
issue_label.go Refactor label.IsArchived() (#29750) 12 months ago
issue_label_test.go Move context from modules to services (#29440) 1 year ago
issue_lock.go Move context from modules to services (#29440) 1 year ago
issue_pin.go Refactor names (#31405) 8 months ago
issue_stopwatch.go Move context from modules to services (#29440) 1 year ago
issue_test.go
issue_timetrack.go Refactor names (#31405) 8 months ago
issue_watch.go Move context from modules to services (#29440) 1 year ago
main_test.go
middlewares.go Move context from modules to services (#29440) 1 year ago
migrate.go Move context from modules to services (#29440) 1 year ago
milestone.go Refactor names (#31405) 8 months ago
packages.go Remove AddParamIfExist(AddParam) (#29841) 11 months ago
patch.go Move context from modules to services (#29440) 1 year ago
projects.go Add issue comment when moving issues from one column to another of the project (#29311) 7 months ago
projects_test.go Refactor names (#31405) 8 months ago
pull.go Avoid returning without written ctx when posting PR (#31843) 6 months ago
pull_review.go Prevent allow/reject reviews on merged/closed PRs (#30686) 10 months ago
pull_review_test.go Fix template error when comment review doesn't exist (#29888) 11 months ago
recent_commits.go Move context from modules to services (#29440) 1 year ago
release.go Refactor names (#31405) 8 months ago
release_test.go Move context from modules to services (#29440) 1 year ago
render.go Fix rendered wiki page link (#31398) 8 months ago
repo.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 7 months ago
search.go Improve grep search (#30843) 10 months ago
search_test.go Improve grep search (#30843) 10 months ago
topic.go Move context from modules to services (#29440) 1 year ago
treelist.go Move context from modules to services (#29440) 1 year ago
view.go render plain text file if the LFS object doesn't exist (#31812) 6 months ago
view_test.go
wiki.go Fix raw wiki links (#31825) 6 months ago
wiki_test.go Fix raw wiki links (#31825) 6 months ago