about summary refs log tree commit diff
path: root/lib/sanitize_ext/sanitize_config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sanitize_ext/sanitize_config.rb')
-rw-r--r--lib/sanitize_ext/sanitize_config.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sanitize_ext/sanitize_config.rb b/lib/sanitize_ext/sanitize_config.rb
index dfc586561..4c0e9b858 100644
--- a/lib/sanitize_ext/sanitize_config.rb
+++ b/lib/sanitize_ext/sanitize_config.rb
@@ -48,9 +48,9 @@ class Sanitize
         node.content = "[🖼  #{node['alt']}]"
       else
         url = node['href']
-        prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s
+        prefix = url.match(%r{\Ahttps?://(www\.)?}).to_s
         text   = url[prefix.length, 30]
-        text   = text + "…" if url[prefix.length..-1].length > 30
+        text += '…' if url.length - prefix.length > 30
         node.content = "[🖼  #{text}]"
       end
     end
@@ -88,7 +88,7 @@ class Sanitize
       },
 
       protocols: {
-        'a'          => { 'href' => LINK_PROTOCOLS },
+        'a' => { 'href' => LINK_PROTOCOLS },
         'blockquote' => { 'cite' => LINK_PROTOCOLS },
       },
 
@@ -126,7 +126,7 @@ class Sanitize
 
       node = env[:node]
 
-      rel = (node['rel'] || '').split(' ') & ['tag']
+      rel = (node['rel'] || '').split & ['tag']
       rel += ['nofollow', 'noopener', 'noreferrer'] unless TagManager.instance.local_url?(node['href'])
 
       if rel.empty?