mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:41:25 +08:00
FEATURE: Support private attachments when using S3 storage (#7677)
* Support private uploads in S3 * Use localStore for local avatars * Add job to update private upload ACL on S3 * Test multisite paths * update ACL for private uploads in migrate_to_s3 task
This commit is contained in:
@ -5,7 +5,6 @@ require_dependency "s3_helper"
|
||||
|
||||
module BackupRestore
|
||||
class S3BackupStore < BackupStore
|
||||
DOWNLOAD_URL_EXPIRES_AFTER_SECONDS ||= 15
|
||||
UPLOAD_URL_EXPIRES_AFTER_SECONDS ||= 21_600 # 6 hours
|
||||
MULTISITE_PREFIX = "backups"
|
||||
|
||||
@ -74,11 +73,12 @@ module BackupRestore
|
||||
end
|
||||
|
||||
def create_file_from_object(obj, include_download_source = false)
|
||||
expires = S3Helper::DOWNLOAD_URL_EXPIRES_AFTER_SECONDS
|
||||
BackupFile.new(
|
||||
filename: File.basename(obj.key),
|
||||
size: obj.size,
|
||||
last_modified: obj.last_modified,
|
||||
source: include_download_source ? presigned_url(obj, :get, DOWNLOAD_URL_EXPIRES_AFTER_SECONDS) : nil
|
||||
source: include_download_source ? presigned_url(obj, :get, expires) : nil
|
||||
)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user