From fd273b05b9513e4ac1b0d7b743acc3c3d36c905c Mon Sep 17 00:00:00 2001 From: Alexander Neumann <62751754+rtpt-alexanderneumann@users.noreply.github.com> Date: Sat, 26 Feb 2022 00:26:43 +0100 Subject: Correctly link URLs to users/repos with dashes, dots or underscores (#18890) * Add tests for references with dashes This commit adds tests for full URLs referencing repos names and user names containing a dash. * Extend regex to match URLs to repos/users with dashes --- modules/markup/html.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/markup/html.go') diff --git a/modules/markup/html.go b/modules/markup/html.go index df2a159230..758746ef87 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 } -- cgit v1.2.3