mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-20 08:31:13 +00:00
Change user archive signed URL TTL from 10 seconds to 1 hour (#34254)
This commit is contained in:
parent
ed54baa6a2
commit
ec2b17860b
|
@ -8,13 +8,15 @@ class BackupsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :set_backup
|
before_action :set_backup
|
||||||
|
|
||||||
|
BACKUP_LINK_TIMEOUT = 1.hour.freeze
|
||||||
|
|
||||||
def download
|
def download
|
||||||
case Paperclip::Attachment.default_options[:storage]
|
case Paperclip::Attachment.default_options[:storage]
|
||||||
when :s3, :azure
|
when :s3, :azure
|
||||||
redirect_to @backup.dump.expiring_url(10), allow_other_host: true
|
redirect_to @backup.dump.expiring_url(BACKUP_LINK_TIMEOUT.to_i), allow_other_host: true
|
||||||
when :fog
|
when :fog
|
||||||
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
|
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
|
||||||
redirect_to @backup.dump.expiring_url(Time.now.utc + 10), allow_other_host: true
|
redirect_to @backup.dump.expiring_url(BACKUP_LINK_TIMEOUT.from_now), allow_other_host: true
|
||||||
else
|
else
|
||||||
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
|
redirect_to full_asset_url(@backup.dump.url), allow_other_host: true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user