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
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
..
admin Support delete user email in admin panel (#31690) 7 months ago
auth OIDC: case-insensitive comparison for auth scheme `Basic` (#31706) 7 months ago
devtest Refactor names (#31405) 8 months ago
events Move context from modules to services (#29440) 1 year ago
explore Add missing repository type filter parameters to pager (#31832) 6 months ago
feed Use GetDisplayName() instead of DisplayName() to generate rss feeds (#31687) 7 months ago
healthcheck Always enable caches (#28527) 1 year ago
misc Make sure git version&feature are always prepared (#30877) 10 months ago
org Add missing repository type filter parameters to pager (#31832) 6 months ago
repo Avoid returning without written ctx when posting PR (#31843) 6 months ago
shared Refactor names (#31405) 8 months ago
user Add missing repository type filter parameters to pager (#31832) 6 months ago
base.go Azure blob storage support (#30995) 9 months ago
githttp.go Refactor names (#31405) 8 months ago
goget.go Move context from modules to services (#29440) 1 year ago
home.go migrate some more "OptionalBool" to "Option[bool]" (#29479) 12 months ago
metrics.go Implement FSFE REUSE for golang files (#21840) 2 years ago
nodeinfo.go Move context from modules to services (#29440) 1 year ago
passkey.go Move context from modules to services (#29440) 1 year ago
swagger_json.go Move context from modules to services (#29440) 1 year ago
web.go Support delete user email in admin panel (#31690) 7 months ago
webfinger.go Move context from modules to services (#29440) 1 year ago