From 8baf5bb40d0a0cf0d2839d1b031f3a971bda4fc9 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 17 Dec 2015 13:21:09 +1100 Subject: [PATCH] FIX: not proxying protocol-less urls --- app/controllers/user_avatars_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/user_avatars_controller.rb b/app/controllers/user_avatars_controller.rb index 47941ac9997..3b57d0578db 100644 --- a/app/controllers/user_avatars_controller.rb +++ b/app/controllers/user_avatars_controller.rb @@ -118,6 +118,11 @@ class UserAvatarsController < ApplicationController PROXY_PATH = Rails.root + "tmp/avatar_proxy" def proxy_avatar(url) + + if url[0..1] == "//" + url = (SiteSetting.use_https ? "https:" : "http:") + url + end + sha = Digest::SHA1.hexdigest(url) filename = "#{sha}#{File.extname(url)}" path = "#{PROXY_PATH}/#{filename}"