FIX: don't put attachments on the CDN when 'prevent anons from downloading files' is enabled

This commit is contained in:
Régis Hanol
2017-02-07 18:06:44 +01:00
parent 49e7124a5e
commit 02bb7beaaf
2 changed files with 46 additions and 9 deletions

View File

@ -308,8 +308,8 @@ class CookedPostProcessor
end
def optimize_urls
# when login is required, attachments can't be on the CDN
if SiteSetting.login_required
# attachments can't be on the CDN when either setting is enabled
if SiteSetting.login_required || SiteSetting.prevent_anons_from_downloading_files
@doc.css("a.attachment[href]").each do |a|
href = a["href"].to_s
a["href"] = UrlHelper.schemaless UrlHelper.absolute_without_cdn(href) if UrlHelper.is_local(href)