Revert "FIX: migrate_to_s3 rake task with folder path"

Revert “FIX: migrate_to_s3 rake task with folder path”

This reverts commit 97fd12e8af1ba3817a640c91ec26c3da46b385f5.

diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake
index 7df7dcc..1063327 100644
--- a/lib/tasks/uploads.rake
+++ b/lib/tasks/uploads.rake
@@ -251,17 +251,14 @@ def migrate_to_s3
     bucket, folder = S3Helper.get_bucket_and_folder_path(ENV["DISCOURSE_S3_BUCKET"])
     folder = File.join(folder, "/")
   else
-    bucket = GlobalSetting.s3_bucket
-    folder = ""
+    bucket, folder = GlobalSetting.s3_bucket, ""
   end
 
-  unless bucket_has_folder_path
-    begin
-      s3.head_bucket(bucket: bucket)
-    rescue Aws::S3::Errors::NotFound
-      puts "Bucket '#{bucket}' not found. Creating it..."
-      s3.create_bucket(bucket: bucket) unless dry_run
-    end
+  begin
+    s3.head_bucket(bucket: bucket)
+  rescue Aws::S3::Errors::NotFound
+    puts "Bucket '#{bucket}' not found. Creating it..."
+    s3.create_bucket(bucket: bucket) unless dry_run
   end
 
   puts "Uploading files to S3..."
@@ -277,7 +274,7 @@ def migrate_to_s3
   print " - Listing S3 files"
 
   s3_objects = []
-  prefix = Rails.configuration.multisite ? "#{folder}#{db}/original/" : "#{folder}original/"
+  prefix = Rails.configuration.multisite ? "#{db}/original/" : "original/"
   options = { bucket: bucket, prefix: prefix }
 
   loop do

GitHub sha: 3ec38f5a

1 Like

FIX: include folder name in prefix for listing files on S3 (follow-up on 3ec38f5a)