mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: include folder name in prefix for listing files on S3 (follow-up on 3ec38f5a
)
Fix the destination url in remap since it's already a part of s3_base_url
This commit is contained in:
parent
ec58c33e9e
commit
10fbb07e1a
@ -275,7 +275,7 @@ def migrate_to_s3
|
|||||||
|
|
||||||
s3_objects = []
|
s3_objects = []
|
||||||
prefix = Rails.configuration.multisite ? "#{db}/original/" : "original/"
|
prefix = Rails.configuration.multisite ? "#{db}/original/" : "original/"
|
||||||
options = { bucket: bucket, prefix: prefix }
|
options = { bucket: bucket, prefix: prefix + folder }
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
response = s3.list_objects_v2(options)
|
response = s3.list_objects_v2(options)
|
||||||
@ -347,7 +347,7 @@ def migrate_to_s3
|
|||||||
}
|
}
|
||||||
|
|
||||||
from = "/uploads/#{db}/original/(\\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\\.]*)"
|
from = "/uploads/#{db}/original/(\\dX/(?:[a-f0-9]/)*[a-f0-9]{40}[a-z0-9\\.]*)"
|
||||||
to = "#{SiteSetting.Upload.s3_base_url}/#{folder}#{prefix}\\1"
|
to = "#{SiteSetting.Upload.s3_base_url}/#{prefix}\\1"
|
||||||
|
|
||||||
if dry_run
|
if dry_run
|
||||||
puts "REPLACING '#{from}' WITH '#{to}'"
|
puts "REPLACING '#{from}' WITH '#{to}'"
|
||||||
|
Loading…
Reference in New Issue
Block a user