Skip to content

Commit 7512b4e

Browse files
committed
Retain original filename after update_url task
1 parent f307469 commit 7512b4e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/tasks/cortex.rake

+2
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,11 @@ namespace :cortex do
221221
object_key = media.attachment.arbitrary_url_for args[:old_path]
222222

223223
begin
224+
previous_filename = media.attachment_file_name
224225
image = s3.get_object({bucket: ENV['S3_BUCKET_NAME'], key: object_key}).body
225226
puts "Re-saving image attachment #{media.id} - #{media.attachment_file_name}"
226227
media.attachment = image
228+
media.attachment_file_name = previous_filename
227229
media.save
228230
# if there are multiple styles (thumbnail, etc), recreate them:
229231
media.attachment.reprocess!

0 commit comments

Comments
 (0)