mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
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:
@ -16,7 +16,7 @@ class EmbeddableHost < ActiveRecord::Base
|
||||
def self.record_for_url(uri)
|
||||
if uri.is_a?(String)
|
||||
uri = begin
|
||||
URI(UrlHelper.escape_uri(uri))
|
||||
URI(UrlHelper.normalized_encode(uri))
|
||||
rescue URI::Error, Addressable::URI::InvalidURIError
|
||||
end
|
||||
end
|
||||
@ -50,7 +50,7 @@ class EmbeddableHost < ActiveRecord::Base
|
||||
return true if url&.starts_with?(Discourse.base_url) && EmbeddableHost.exists?
|
||||
|
||||
uri = begin
|
||||
URI(UrlHelper.escape_uri(url))
|
||||
URI(UrlHelper.normalized_encode(url))
|
||||
rescue URI::Error
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user