aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/html_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r--modules/markup/html_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index a2ae18d777..6b3bcd7257 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -156,13 +156,18 @@ func TestRender_links(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(buffer))
}
- // Text that should be turned into URL
- defaultCustom := setting.Markdown.CustomURLSchemes
+ oldCustomURLSchemes := setting.Markdown.CustomURLSchemes
+ markup.ResetDefaultSanitizerForTesting()
+ defer func() {
+ setting.Markdown.CustomURLSchemes = oldCustomURLSchemes
+ markup.ResetDefaultSanitizerForTesting()
+ markup.CustomLinkURLSchemes(oldCustomURLSchemes)
+ }()
setting.Markdown.CustomURLSchemes = []string{"ftp", "magnet"}
- markup.InitializeSanitizer()
markup.CustomLinkURLSchemes(setting.Markdown.CustomURLSchemes)
+ // Text that should be turned into URL
test(
"https://www.example.com",
`<p><a href="https://www.example.com" rel="nofollow">https://www.example.com</a></p>`)
@@ -246,11 +251,6 @@ func TestRender_links(t *testing.T) {
test(
"ftps://gitea.com",
`<p>ftps://gitea.com</p>`)
-
- // Restore previous settings
- setting.Markdown.CustomURLSchemes = defaultCustom
- markup.InitializeSanitizer()
- markup.CustomLinkURLSchemes(setting.Markdown.CustomURLSchemes)
}
func TestRender_email(t *testing.T) {