DEV: Rename UriHelper.escape_uri to .normalized_encode

This is a much better description of its function. It performs idempotent normalization of a URL. If consumers truly need to `encode` a URL (including double-encoding of existing encoded entities), they can use the existing `.encode` method.
This commit is contained in:
David Taylor
2022-08-09 11:28:29 +01:00
parent f0a0252526
commit 3c81683955
9 changed files with 40 additions and 34 deletions

View File

@ -147,7 +147,7 @@ after_initialize do
post = options[:post]
replacement = post&.url.present? ?
"<a href='#{UrlHelper.escape_uri(post.url)}'>#{I18n.t("poll.poll")}</a>" :
"<a href='#{UrlHelper.normalized_encode(post.url)}'>#{I18n.t("poll.poll")}</a>" :
I18n.t("poll.poll")
doc.css("div.poll").each do |poll|