Separate relative base_url and upload_path

This makes easier to reason about paths
This commit is contained in:
Rafael dos Santos Silva 2016-03-10 00:47:18 -03:00
parent 4d01328bc2
commit c2e0eeb089

View File

@ -34,8 +34,12 @@ module FileStore
"#{Discourse.asset_host}#{relative_base_url}"
end
def upload_path
"/uploads/#{RailsMultisite::ConnectionManagement.current_db}"
end
def relative_base_url
"#{Discourse.base_uri}/uploads/#{RailsMultisite::ConnectionManagement.current_db}"
"#{Discourse.base_uri}#{upload_path}"
end
def external?
@ -57,7 +61,7 @@ module FileStore
end
def get_path_for(type, upload_id, sha, extension)
"#{relative_base_url}/#{super(type, upload_id, sha, extension)}"
"#{upload_path}/#{super(type, upload_id, sha, extension)}"
end
def copy_file(file, path)