Skip to content

Commit c21e01b

Browse files
committed
Fix issue NumericPattern link does not support quotes (#29484)
1 parent 7e16b75 commit c21e01b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

modules/references/references.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var (
3131
// mentionPattern matches all mentions in the form of "@user" or "@org/team"
3232
mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_]+\/?[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+\/?[0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`)
3333
// issueNumericPattern matches string that references to a numeric issue, e.g. #1287
34-
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\')([#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
34+
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\'|\")([#!][0-9]+)(?:\s|$|\)|\]|\'|\"|[:;,.?!]\s|[:;,.?!]$)`)
3535
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
3636
issueAlphanumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[|\"|\')([A-Z]{1,10}-[1-9][0-9]*)(?:\s|$|\)|\]|:|\.(\s|$)|\"|\')`)
3737
// crossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository

modules/references/references_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ func TestRegExp_issueNumericPattern(t *testing.T) {
429429
" #12",
430430
"#12:",
431431
"ref: #12: msg",
432+
"\"#1234\"",
433+
"'#1234'",
432434
}
433435
falseTestCases := []string{
434436
"# 1234",

0 commit comments

Comments
 (0)