@@ -1,9 +1,12 @@
 # frozen_string_literal: true
 
+# rubocop: disable Lint/UriEscapeUnescape
+
 module LinksHelper
   def safe_slice_host(url, length = 33)
-    safe_url = sanitize(url)
+    safe_url = sanitize(URI.encode(url))
     hostname = URI.parse(safe_url).host
     truncate(hostname, length: length)
   end
 end
+# rubocop: enable Lint/UriEscapeUnescape
# frozen_string_literal: true

module LinksHelper
  def safe_slice_host(url, length = 33)
    safe_url = sanitize(url)
    hostname = URI.parse(safe_url).host
    truncate(hostname, length: length)
  end
end

rubocop considers URI.encode as bad practice. We need some research into why it is so. Do not merge until we get some information on this.