From b629fa5e8cf122fc5bc429e307fff9bce2ae8d2d Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 21 Jun 2026 14:00:36 +0200 Subject: [PATCH] Remove html tags the Rails way when generating permalinks --- lib/publify_core/string_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/publify_core/string_ext.rb b/lib/publify_core/string_ext.rb index e5042c7f..f9c20dca 100644 --- a/lib/publify_core/string_ext.rb +++ b/lib/publify_core/string_ext.rb @@ -18,7 +18,7 @@ def to_permalink string = string.tr(key.join, value) end string = string.tr("'", "-") - string.gsub(/<[^>]*>/, "").to_url + Rails::HTML5::FullSanitizer.new.sanitize(string).to_url end # Returns a-string-with-dashes when passed 'a string with dashes'.