Skip to content

Commit

Permalink
normalize_url strip the url before parse it
Browse files Browse the repository at this point in the history
  • Loading branch information
LuYangP committed Dec 29, 2017
1 parent b4ae4c1 commit c812ca7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/url_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def expand_absolute_urls(content, base_url)
end

def normalize_url(url, base_url)
uri = URI.parse(url)
uri = URI.parse(url.strip)

# resolve (protocol) relative URIs
if uri.relative?
base_uri = URI.parse(base_url)
base_uri = URI.parse(base_url.strip)
scheme = base_uri.scheme || "http"
uri = URI.join("#{scheme}://#{base_uri.host}", uri)
end
Expand Down

0 comments on commit c812ca7

Please sign in to comment.