Change media attachments in moderated posts to not be accessible (#34872)

This commit is contained in:
Eugen Rochko 2025-06-12 10:53:02 +02:00 committed by GitHub
commit 24d943fee0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 140 additions and 111 deletions

View file

@ -12,18 +12,7 @@ class BackupsController < ApplicationController
BACKUP_LINK_TIMEOUT = 1.hour.freeze
def download
case Paperclip::Attachment.default_options[:storage]
when :s3, :azure
redirect_to @backup.dump.expiring_url(BACKUP_LINK_TIMEOUT.to_i), allow_other_host: true
when :fog
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
redirect_to @backup.dump.expiring_url(BACKUP_LINK_TIMEOUT.from_now), allow_other_host: true
else
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
end
when :filesystem
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
end
redirect_to expiring_asset_url(@backup.dump, BACKUP_LINK_TIMEOUT), allow_other_host: true
end
private