diff --git a/modules/markup/html.go b/modules/markup/html.go index 345c99e3b4..52430a83e4 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -99,7 +99,7 @@ var issueFullPatternOnce sync.Once func getIssueFullPattern() *regexp.Regexp { issueFullPatternOnce.Do(func() { issueFullPattern = regexp.MustCompile(regexp.QuoteMeta(setting.AppURL) + - `\w+/\w+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#](\S+)?)?\b`) + `[\w_.-]+/[\w_.-]+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#](\S+)?)?\b`) }) return issueFullPattern } diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index 23d7b44570..879e69fc0e 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -95,6 +95,15 @@ func TestRender_CrossReferences(t *testing.T) { test( "/home/gitea/go-gitea/gitea#12345", `
/home/gitea/go-gitea/gitea#12345
`) + test( + util.URLJoin(TestAppURL, "gogitea", "gitea", "issues", "12345"), + ``) + test( + util.URLJoin(TestAppURL, "go-gitea", "gitea", "issues", "12345"), + ``) + test( + util.URLJoin(TestAppURL, "gogitea", "some-repo-name", "issues", "12345"), + ``) } func TestMisc_IsSameDomain(t *testing.T) {