mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
fix get from url for external uploads without CDN
This commit is contained in:
@@ -79,6 +79,8 @@ class Upload < ActiveRecord::Base
|
||||
return if url.blank?
|
||||
# we store relative urls, so we need to remove any host/cdn
|
||||
url = url.sub(Discourse.asset_host, "") if Discourse.asset_host.present? && Discourse.asset_host != SiteSetting.Upload.s3_cdn_url
|
||||
# when using s3 without CDN
|
||||
url = url.sub(/^https?\:/, "") if url.include?(Discourse.store.absolute_base_url) && Discourse.store.external?
|
||||
# when using s3, we need to replace with the absolute base url
|
||||
url = url.sub(SiteSetting.Upload.s3_cdn_url, Discourse.store.absolute_base_url) if SiteSetting.Upload.s3_cdn_url.present?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user