mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FIX: don't use the CDN for attachments when login is required
This commit is contained in:
@ -276,6 +276,14 @@ class CookedPostProcessor
|
||||
end
|
||||
|
||||
def optimize_urls
|
||||
# when login is required, attachments can't be on the CDN
|
||||
if SiteSetting.login_required
|
||||
@doc.css("a.attachment[href]").each do |a|
|
||||
href = a["href"].to_s
|
||||
a["href"] = UrlHelper.schemaless UrlHelper.absolute(href, nil) if UrlHelper.is_local(href)
|
||||
end
|
||||
end
|
||||
|
||||
%w{href data-download-href}.each do |selector|
|
||||
@doc.css("a[#{selector}]").each do |a|
|
||||
href = a["#{selector}"].to_s
|
||||
|
Reference in New Issue
Block a user