Rename s3 vars, change condition when displaying s3 uploads

This commit is contained in:
Maja Komel 2018-06-25 17:16:01 +02:00 committed by Joffrey JAFFEUX
parent b3073175a7
commit 24dfa1b657
3 changed files with 5 additions and 5 deletions

View File

@ -33,8 +33,8 @@ const Discourse = Ember.Application.extend({
// only relative urls
if (Discourse.CDN && /^\/[^\/]/.test(url)) {
url = Discourse.CDN + url;
} else if (Discourse.S3CDN) {
url = url.replace(Discourse.S3BaseUrl, Discourse.S3CDN);
} else if (Discourse.UploadCDN) {
url = url.replace(Discourse.UploadBaseUrl, Discourse.UploadCDN);
}
return url;
},

View File

@ -428,7 +428,7 @@ export function uploadLocation(url) {
if (Discourse.CDN) {
url = Discourse.getURLWithCDN(url);
return /^\/\//.test(url) ? "http:" + url : url;
} else if (Discourse.SiteSettings.enable_s3_uploads) {
} else if (Discourse.UploadBaseUrl) {
return "https:" + url;
} else {
var protocol = window.location.protocol + "//",

View File

@ -56,9 +56,9 @@
Discourse.HighlightJSPath = <%= HighlightJs.path.inspect.html_safe %>;
<%- if SiteSetting.Upload.enable_s3_uploads %>
<%- if SiteSetting.Upload.s3_cdn_url.present? %>
Discourse.S3CDN = '<%= SiteSetting.Upload.s3_cdn_url %>';
Discourse.UploadCDN = '<%= SiteSetting.Upload.s3_cdn_url %>';
<%- end %>
Discourse.S3BaseUrl = '<%= SiteSetting.Upload.absolute_base_url %>';
Discourse.UploadBaseUrl = '<%= SiteSetting.Upload.absolute_base_url %>';
<%- end %>
})();
</script>