summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2019-07-14 10:48:51 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2019-07-14 22:48:51 +0800
commitfb0c562f8ba32804c5d025abe23a0c0a23ca181e (patch)
treea28730a96f057901a59c91e9c9163af397639c58 /models/action.go
parent97078d1bdf26cfc99e093234348ddea74af40baf (diff)
downloadgitea-fb0c562f8ba32804c5d025abe23a0c0a23ca181e.tar.gz
gitea-fb0c562f8ba32804c5d025abe23a0c0a23ca181e.zip
Fix regex for issues in commit messages (#7444)
* Fix regex for issues in commit messages Use same regex as markup for matching in commits. Fixes #7438 * make fmt
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/action.go b/models/action.go
index 21b008e3be..a092f564bf 100644
--- a/models/action.go
+++ b/models/action.go
@@ -65,6 +65,7 @@ var (
)
const issueRefRegexpStr = `(?:([0-9a-zA-Z-_\.]+)/([0-9a-zA-Z-_\.]+))?(#[0-9]+)+`
+const issueRefRegexpStrNoKeyword = `(?:\s|^|\(|\[)(?:([0-9a-zA-Z-_\.]+)/([0-9a-zA-Z-_\.]+))?(#[0-9]+)(?:\s|$|\)|\]|\.(\s|$))`
func assembleKeywordsPattern(words []string) string {
return fmt.Sprintf(`(?i)(?:%s)(?::?) %s`, strings.Join(words, "|"), issueRefRegexpStr)
@@ -73,7 +74,7 @@ func assembleKeywordsPattern(words []string) string {
func init() {
issueCloseKeywordsPat = regexp.MustCompile(assembleKeywordsPattern(issueCloseKeywords))
issueReopenKeywordsPat = regexp.MustCompile(assembleKeywordsPattern(issueReopenKeywords))
- issueReferenceKeywordsPat = regexp.MustCompile(issueRefRegexpStr)
+ issueReferenceKeywordsPat = regexp.MustCompile(issueRefRegexpStrNoKeyword)
}
// Action represents user operation type and other information to