FIX: `migrate_to_s3` task not setting the right content_disposition.

FIX: migrate_to_s3 task not setting the right content_disposition.

diff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rake
index cb99d69..852075c 100644
--- a/lib/tasks/uploads.rake
+++ b/lib/tasks/uploads.rake
@@ -315,7 +315,12 @@ def migrate_to_s3
     }
 
     if !FileHelper.is_supported_image?(name)
-      options[:content_disposition] = %Q{attachment; filename="#{name}"}
+      upload = Upload.find_by(url: "/#{file}")
+
+      if upload&.original_filename
+        options[:content_disposition] =
+          %Q{attachment; filename="#{upload.original_filename}"}
+      end
     end
 
     if dry_run

GitHub sha: 99cd3ff6

1 Like