about summary refs log tree commit diff
path: root/lib/paperclip/type_corrector.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/paperclip/type_corrector.rb')
-rw-r--r--lib/paperclip/type_corrector.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/paperclip/type_corrector.rb b/lib/paperclip/type_corrector.rb
index 0b0c10a56..17e2fc5da 100644
--- a/lib/paperclip/type_corrector.rb
+++ b/lib/paperclip/type_corrector.rb
@@ -5,13 +5,15 @@ require 'mime/types/columnar'
 module Paperclip
   class TypeCorrector < Paperclip::Processor
     def make
-      target_extension = options[:format]
-      extension        = File.extname(attachment.instance.file_file_name)
+      return @file unless options[:format]
+
+      target_extension = '.' + options[:format]
+      extension        = File.extname(attachment.instance_read(:file_name))
 
       return @file unless options[:style] == :original && target_extension && extension != target_extension
 
-      attachment.instance.file_content_type = options[:content_type] || attachment.instance.file_content_type
-      attachment.instance.file_file_name    = File.basename(attachment.instance.file_file_name, '.*') + '.' + target_extension
+      attachment.instance_write(:content_type, options[:content_type] || attachment.instance_read(:content_type))
+      attachment.instance_write(:file_name, File.basename(attachment.instance_read(:file_name), '.*') + target_extension)
 
       @file
     end