diff options
author | Lauris BH <lauris@nix.lv> | 2018-01-27 14:33:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 14:33:32 +0200 |
commit | a0c397df08b3e2de0e438a2404dd6f8edf866acb (patch) | |
tree | 9f3c470bc291fb11d15574cd632afa8fe565a1a7 /modules | |
parent | 9e87fe8c0693bf5554c34c5189be114a631183e4 (diff) | |
download | gitea-a0c397df08b3e2de0e438a2404dd6f8edf866acb.tar.gz gitea-a0c397df08b3e2de0e438a2404dd6f8edf866acb.zip |
Recognize more characters in crossreferenced repo name (#3413)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/markup/html.go | 2 | ||||
-rw-r--r-- | modules/markup/html_test.go | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/modules/markup/html.go b/modules/markup/html.go index 5325339762..d33afd3841 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -43,7 +43,7 @@ var ( IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`) // CrossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository // e.g. gogits/gogs#12345 - CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z]+/[0-9a-zA-Z]+#[0-9]+\b`) + 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 // Although SHA1 hashes are 40 chars long, the regex matches the hash from 7 to 40 chars in length diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index e3597a4c3a..5e783c754f 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -285,6 +285,9 @@ func TestRender_CrossReferences(t *testing.T) { test( "gogits/gogs#12345", `<p><a href="`+URLJoin(AppURL, "gogits", "gogs", "issues", "12345")+`" rel="nofollow">gogits/gogs#12345</a></p>`) + test( + "go-gitea/gitea#12345", + `<p><a href="`+URLJoin(AppURL, "go-gitea", "gitea", "issues", "12345")+`" rel="nofollow">go-gitea/gitea#12345</a></p>`) } func TestRender_FullIssueURLs(t *testing.T) { |