Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove monkey patch from Addressable::URI#normalized_query so that it can be compatible with Addressable 2.8.2 #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions lib/postrank-uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ def domain
host = self.host
(host && PublicSuffix.valid?(host, default_rule: nil)) ? PublicSuffix.parse(host).domain : nil
end

def normalized_query
@normalized_query ||= (begin
if self.query && self.query.strip != ''
(self.query.strip.split("&", -1).map do |pair|
Addressable::URI.normalize_component(
pair,
Addressable::URI::CharacterClasses::QUERY.sub("\\&", "")
)
end).join("&")
else
nil
end
end)
end

end
end

Expand Down Expand Up @@ -152,6 +136,7 @@ def hash(uri, opts = {})
end

def normalize(uri, opts = {})
uri = uri.to_s.split(' ').first
u = parse(uri, opts)
u.path = u.path.gsub(URIREGEX[:double_slash_outside_scheme], '/')
u.path = u.path.chomp('/') if u.path.size != 1
Expand Down