summaryrefslogtreecommitdiff
path: root/internal/text/sanitize.go
diff options
context:
space:
mode:
authorLibravatar D <github@david.kitchen>2022-11-07 13:25:36 +0000
committerLibravatar GitHub <noreply@github.com>2022-11-07 14:25:36 +0100
commit53a1e477915f81d27678e73b9d90f8debdb3cd2f (patch)
tree2234659628647cd116e6fe5b5a1cab8f2dc41a4e /internal/text/sanitize.go
parent[chore] Bump github.com/tdewolff/minify/v2 from 2.12.1 to 2.12.4 (#985) (diff)
downloadgotosocial-53a1e477915f81d27678e73b9d90f8debdb3cd2f.tar.xz
[chore] Fix rel="nofollow" so that it only applies to external links (#991)
Resolves https://github.com/superseriousbusiness/gotosocial/issues/990
Diffstat (limited to 'internal/text/sanitize.go')
-rw-r--r--internal/text/sanitize.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/text/sanitize.go b/internal/text/sanitize.go
index 96b7ef994..fd7ee2006 100644
--- a/internal/text/sanitize.go
+++ b/internal/text/sanitize.go
@@ -33,7 +33,8 @@ import (
// Source: https://github.com/microcosm-cc/bluemonday#usage
var regular *bluemonday.Policy = bluemonday.UGCPolicy().
RequireNoReferrerOnLinks(true).
- RequireNoFollowOnLinks(true).
+ RequireNoFollowOnLinks(false). // remove the global default which adds rel="nofollow" to all links including local relative
+ RequireNoFollowOnFullyQualifiedLinks(true). // add rel="nofollow" on all external links
RequireCrossOriginAnonymous(true).
AddTargetBlankToFullyQualifiedLinks(true).
AllowAttrs("class", "href", "rel").OnElements("a").