diff options
author | Unknwon <u@gogs.io> | 2018-08-17 20:02:43 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-08-17 20:02:43 +0800 |
commit | 844d69143fb49305f587d5a25e009521751b8e29 (patch) | |
tree | 247fb3ec9673f0a87910d64de13a89b64776c19b /pkg | |
parent | 77275a9b311ed126f887628f33fbd917750420cd (diff) |
pkg/markup: allow match SHA1 length 7-40 (#3321)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/markup/markup.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/markup/markup.go b/pkg/markup/markup.go index b8e1519d..2d571489 100644 --- a/pkg/markup/markup.go +++ b/pkg/markup/markup.go @@ -53,9 +53,8 @@ var ( CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`) // Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae - // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern - // by converting string to a number. - Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{40}\b`) + // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern by converting string to a number. + Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{7,40}\b`) ) // FindAllMentions matches mention patterns in given content |