From c812ca7822d08686859a773b45a2155d016b3114 Mon Sep 17 00:00:00 2001 From: Lv Yangpeng Date: Fri, 29 Dec 2017 16:20:20 +0800 Subject: [PATCH] normalize_url strip the url before parse it --- app/helpers/url_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/url_helpers.rb b/app/helpers/url_helpers.rb index 9d4c6fc7e..6c3a97bef 100644 --- a/app/helpers/url_helpers.rb +++ b/app/helpers/url_helpers.rb @@ -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