From c6b411f6c18efc41010afcb83f2a712f642d3a23 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sun, 19 Apr 2020 20:24:27 +0200 Subject: [PATCH] FIX: Restore to S3 didn't work without env variables The `uplaods:migrate_to_s3` rake task should always use the environment variables, because you usually don't want to break your site's uploads during the migration. But restoring a backup should work with site settings as well as environment variables, otherwise you can't restore uploads to S3 from the web interface. --- lib/file_store/s3_store.rb | 2 +- lib/file_store/to_s3_migration.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file_store/s3_store.rb b/lib/file_store/s3_store.rb index 053b23aa32e..6a26ebd7ee6 100644 --- a/lib/file_store/s3_store.rb +++ b/lib/file_store/s3_store.rb @@ -198,7 +198,7 @@ module FileStore FileUtils.symlink(source_path, public_upload_path) FileStore::ToS3Migration.new( - s3_options: FileStore::ToS3Migration.s3_options_from_env, + s3_options: FileStore::ToS3Migration.s3_options_from_site_settings, migrate_to_multisite: Rails.configuration.multisite, ).migrate diff --git a/lib/file_store/to_s3_migration.rb b/lib/file_store/to_s3_migration.rb index 6792b94e4ae..6f19f2d00fd 100644 --- a/lib/file_store/to_s3_migration.rb +++ b/lib/file_store/to_s3_migration.rb @@ -21,7 +21,7 @@ module FileStore def self.s3_options_from_site_settings { client_options: S3Helper.s3_options(SiteSetting), - bucket: SiteSetting.s3_upload_bucket + bucket: SiteSetting.Upload.s3_upload_bucket } end