From 9bf381b95c5f29fce9c7a40e7a3d55da2ba8d9df Mon Sep 17 00:00:00 2001 From: scossar Date: Mon, 20 Jun 2016 14:03:24 -0700 Subject: [PATCH] get urlWithCDN before appending protocol --- app/assets/javascripts/discourse/lib/utilities.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js index 491e2b6a2..95aa9b8b0 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js +++ b/app/assets/javascripts/discourse/lib/utilities.js @@ -251,7 +251,8 @@ Discourse.Utilities = { uploadLocation: function(url) { if (Discourse.CDN) { - return Discourse.CDN.startsWith('//') ? "http:" + Discourse.getURLWithCDN(url) : Discourse.getURLWithCDN(url); + url = Discourse.getURLWithCDN(url); + return url.startsWith('//') ? 'http:' + url : url; } else if (Discourse.SiteSettings.enable_s3_uploads) { return 'https:' + url; } else {