SECURITY: Make sure uploaded_urls have corresponding upload records

This commit is contained in:
Robin Ward
2016-07-28 13:54:17 -04:00
parent cf5b756b1a
commit 2891f230d1
8 changed files with 67 additions and 11 deletions

View File

@ -186,9 +186,13 @@ module Discourse
ActionController::Base.config.relative_url_root.presence || default_value
end
def self.base_protocol
SiteSetting.force_https? ? "https" : "http"
end
def self.base_url_no_prefix
protocol, default_port = SiteSetting.force_https? ? ["https", 443] : ["http", 80]
url = "#{protocol}://#{current_hostname}"
default_port = SiteSetting.force_https? ? 443 : 80
url = "#{base_protocol}://#{current_hostname}"
url << ":#{SiteSetting.port}" if SiteSetting.port.to_i > 0 && SiteSetting.port.to_i != default_port
url
end