mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
Separate relative base_url and upload_path
This makes easier to reason about paths
This commit is contained in:
parent
4d01328bc2
commit
c2e0eeb089
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user