FIX: not proxying protocol-less urls

This commit is contained in:
Sam 2015-12-17 13:21:09 +11:00
parent 29f6d960c6
commit 8baf5bb40d
1 changed files with 5 additions and 0 deletions

View File

@ -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}"