From a1fc35fdf73c7652386ead75ffbe17420f06a17b Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Fri, 2 Aug 2019 07:08:21 +0530 Subject: [PATCH] FIX: make uploads recovery compatible with multisite. --- lib/upload_recovery.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/upload_recovery.rb b/lib/upload_recovery.rb index 95af2dcedd9..eb10c2a80ac 100644 --- a/lib/upload_recovery.rb +++ b/lib/upload_recovery.rb @@ -135,9 +135,16 @@ class UploadRecovery @object_keys ||= begin s3_helper = Discourse.store.s3_helper - s3_helper.list("original").map(&:key).concat( - s3_helper.list("#{FileStore::S3Store::TOMBSTONE_PREFIX}original").map(&:key) - ) + if Rails.configuration.multisite + current_db = RailsMultisite::ConnectionManagement.current_db + s3_helper.list("uploads/#{current_db}/original").map(&:key).concat( + s3_helper.list("uploads/#{FileStore::S3Store::TOMBSTONE_PREFIX}#{current_db}/original").map(&:key) + ) + else + s3_helper.list("original").map(&:key).concat( + s3_helper.list("#{FileStore::S3Store::TOMBSTONE_PREFIX}original").map(&:key) + ) + end end @object_keys.each do |key|