summaryrefslogtreecommitdiffstats
path: root/modules/markup/html_test.go
diff options
context:
space:
mode:
authorAlexander Neumann <62751754+rtpt-alexanderneumann@users.noreply.github.com>2022-02-26 00:26:43 +0100
committerGitHub <noreply@github.com>2022-02-26 00:26:43 +0100
commitfd273b05b9513e4ac1b0d7b743acc3c3d36c905c (patch)
tree5f88c7d9e610a9a407937e86796056bbb4dc6e48 /modules/markup/html_test.go
parent9d7a431b711ff8b07be3401df0c118ed3574f7f9 (diff)
downloadgitea-fd273b05b9513e4ac1b0d7b743acc3c3d36c905c.tar.gz
gitea-fd273b05b9513e4ac1b0d7b743acc3c3d36c905c.zip
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
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r--modules/markup/html_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index 29bf6c8fcb..f6aabc6272 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -97,6 +97,15 @@ func TestRender_CrossReferences(t *testing.T) {
test(
"/home/gitea/go-gitea/gitea#12345",
`<p>/home/gitea/go-gitea/gitea#12345</p>`)
+ test(
+ util.URLJoin(TestAppURL, "gogitea", "gitea", "issues", "12345"),
+ `<p><a href="`+util.URLJoin(TestAppURL, "gogitea", "gitea", "issues", "12345")+`" class="ref-issue" rel="nofollow">gogitea/gitea#12345</a></p>`)
+ test(
+ util.URLJoin(TestAppURL, "go-gitea", "gitea", "issues", "12345"),
+ `<p><a href="`+util.URLJoin(TestAppURL, "go-gitea", "gitea", "issues", "12345")+`" class="ref-issue" rel="nofollow">go-gitea/gitea#12345</a></p>`)
+ test(
+ util.URLJoin(TestAppURL, "gogitea", "some-repo-name", "issues", "12345"),
+ `<p><a href="`+util.URLJoin(TestAppURL, "gogitea", "some-repo-name", "issues", "12345")+`" class="ref-issue" rel="nofollow">gogitea/some-repo-name#12345</a></p>`)
}
func TestMisc_IsSameDomain(t *testing.T) {