From 35e1e009fa93e8e68dc799d070b7f10afbb66368 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 12 Apr 2021 05:00:52 +0100 Subject: [PATCH] FIX: Allow restoring non-subfolder backup to subfolder site (#12537) `GlobalSetting.relative_url_root` comes from the destination site. We can't be sure whether it was the same on the original site. It's safer to use a wildcard here, so we can backup/restore sites with different relative_url_root values. --- lib/file_store/to_s3_migration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file_store/to_s3_migration.rb b/lib/file_store/to_s3_migration.rb index 85af5a58082..9af8aa3994d 100644 --- a/lib/file_store/to_s3_migration.rb +++ b/lib/file_store/to_s3_migration.rb @@ -135,8 +135,8 @@ module FileStore end def uploads_migrated_to_new_scheme? - seeded_image_url = "#{GlobalSetting.relative_url_root}/uploads/#{@current_db}/original/_X/" - !Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '#{seeded_image_url}%'").exists? + seeded_image_url = "uploads/#{@current_db}/original/_X/" + !Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '/%#{seeded_image_url}%'").exists? end def migrate_to_s3