Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge message template and close issue references cause 500 error #22821

Closed
brechtvl opened this issue Feb 8, 2023 · 1 comment · Fixed by #22822
Closed

Merge message template and close issue references cause 500 error #22821

brechtvl opened this issue Feb 8, 2023 · 1 comment · Fixed by #22822
Labels

Comments

@brechtvl
Copy link
Contributor

brechtvl commented Feb 8, 2023

Description

In a new repository

  • Create .gitea/default_merge_message/SQUASH_TEMPLATE.md with contents for example:
${PullRequestTitle}
  • Create an issue
  • Create a pull request with title Fix #1
  • 500 error when going to the pull request page

It's crashing at services/pull/merge.go:101 while constructing $ClosingIssues for the template.

Can be seen here:
https://try.gitea.io/brechtvl/test/pulls/2

Gitea Version

5ae07d4 (main)

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Both self built and try.gitea.io.

Database

None

brechtvl added a commit to blender/gitea that referenced this issue Feb 8, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 8, 2023

The fix seems to be adding a call to ref.LoadIssue(ctx) before closeIssueIndexes = append(closeIssueIndexes, fmt.Sprintf("%s %s%d", closeWord, issueReference, ref.Issue.Index))

if err = ref.LoadIssue(ctx); err != nil { return .... err }
closeIssueIndexes = append(closeIssueIndexes, fmt.Sprintf("%s %s%d", closeWord, issueReference, ref.Issue.Index))

lunny pushed a commit that referenced this issue Feb 9, 2023
Fixes #22821

Signed-off-by: jolheiser <john.olheiser@gmail.com>
jolheiser added a commit to jolheiser/gitea that referenced this issue Feb 9, 2023
Fixes go-gitea#22821

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants