mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-07 21:04:38 +01:00
fix trailing comma not matched in the case of alphanumeric issue (#32945)
Fix #32428.
Patch the regex to match `,`besides `.` `"` `'` `:` and space.
(cherry picked from commit fb75151fb14e866cab8d893c588f5673902b278b)
(cherry picked from commit 0efd7130f0
)
This commit is contained in:
parent
eb00a80efc
commit
4999de50c3
2 changed files with 2 additions and 1 deletions
|
@ -32,7 +32,7 @@ var (
|
|||
// issueNumericPattern matches string that references to a numeric issue, e.g. #1287
|
||||
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\'|\")([#!][0-9]+)(?:\s|$|\)|\]|\'|\"|[:;,.?!]\s|[:;,.?!]$)`)
|
||||
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
|
||||
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\"|\')([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$)|\"|\')`)
|
||||
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\"|\')([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$)|\"|\'|,)`)
|
||||
// crossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository
|
||||
// e.g. org/repo#12345
|
||||
crossReferenceIssueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+[#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
|
||||
|
|
|
@ -466,6 +466,7 @@ func TestRegExp_issueAlphanumericPattern(t *testing.T) {
|
|||
"ABC-123:",
|
||||
"\"ABC-123\"",
|
||||
"'ABC-123'",
|
||||
"ABC-123, unknown PR",
|
||||
}
|
||||
falseTestCases := []string{
|
||||
"RC-08",
|
||||
|
|
Loading…
Reference in a new issue