From 31f27006e19711902c9bcabea9ce9f400878ed6a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 15 May 2017 15:32:55 -0400 Subject: [PATCH] FIX: We can download protocol relative urls --- lib/file_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/file_helper.rb b/lib/file_helper.rb index e79bdd9fa06..e9e6ab54800 100644 --- a/lib/file_helper.rb +++ b/lib/file_helper.rb @@ -7,6 +7,7 @@ class FileHelper end def self.download(url, max_file_size, tmp_file_name, follow_redirect=false, read_timeout=5) + url = "https:" + url if url.start_with?("//") raise Discourse::InvalidParameters.new(:url) unless url =~ /^https?:\/\// uri = parse_url(url)