Allow theme field object model to support uploads

This commit is contained in:
Sam
2017-05-08 11:38:48 -04:00
parent 26209354e3
commit f709899a1d
6 changed files with 53 additions and 6 deletions

View File

@ -7,6 +7,13 @@ module GlobalPath
"#{GlobalSetting.cdn_url}#{path(p)}"
end
def upload_cdn_path(p)
if SiteSetting.s3_cdn_url.present?
p = p.sub(Discourse.store.absolute_base_url, SiteSetting.s3_cdn_url)
end
p =~ /^http/ ? p : cdn_path(p)
end
def cdn_relative_path(path)
if (cdn_url = GlobalSetting.cdn_url).present?
URI.parse(cdn_url).path + path