FIX: don't disable download_remote_images_to_local if site uses S3 (#7861)

FIX: don’t disable download_remote_images_to_local if site uses S3 (#7861)

diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb
index 1cd4b90..a0c2efd 100644
--- a/lib/cooked_post_processor.rb
+++ b/lib/cooked_post_processor.rb
@@ -642,6 +642,7 @@ class CookedPostProcessor
   def disable_if_low_on_disk_space
     return false if !SiteSetting.download_remote_images_to_local
     return false if available_disk_space >= SiteSetting.download_remote_images_threshold
+    return false if Discourse.store.external?
 
     SiteSetting.download_remote_images_to_local = false
     # log the site setting change
diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb
index cbe8baa..1b55793 100644
--- a/spec/components/cooked_post_processor_spec.rb
+++ b/spec/components/cooked_post_processor_spec.rb
@@ -1158,6 +1158,14 @@ describe CookedPostProcessor do
         expect(SiteSetting.download_remote_images_to_local).to eq(false)
       end
 
+      it "doesn't disable download_remote_images_to_local if site uses S3" do
+        SiteSetting.s3_access_key_id = "s3-access-key-id"
+        SiteSetting.s3_secret_access_key = "s3-secret-access-key"
+        SiteSetting.enable_s3_uploads = true
+        expect(cpp.disable_if_low_on_disk_space).to eq(false)
+        expect(SiteSetting.download_remote_images_to_local).to eq(true)
+      end
+
     end
 
   end

GitHub sha: 65a6f308

1 Like