FIX: Account for empty uploads directory upon backup restore (#8262)

This commit fixes a case where backup restores would fail if the uploads/default directory is empty.
This commit is contained in:
Justin DiRose 2019-10-30 09:33:07 -05:00 committed by GitHub
parent cacf99e144
commit c3f06943c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -436,6 +436,7 @@ module BackupRestore
FileUtils.mkdir_p("uploads")
tmp_uploads_path = Dir.glob(File.join(@tmp_directory, "uploads", "*")).first
return if tmp_uploads_path.blank?
previous_db_name = BackupMetadata.value_for("db_name") || File.basename(tmp_uploads_path)
current_db_name = RailsMultisite::ConnectionManagement.current_db
optimized_images_exist = File.exist?(File.join(tmp_uploads_path, 'optimized'))