Commit 7ef5d0e4 by Mike Mangino Committed by Jon Yurek

Use the original filename to generate temp files

parent c3f194a5
...@@ -34,7 +34,7 @@ module Paperclip ...@@ -34,7 +34,7 @@ module Paperclip
private private
def destination def destination
@destination ||= TempfileFactory.new.generate @destination ||= TempfileFactory.new.generate(@original_filename)
end end
def copy_to_tempfile(src) def copy_to_tempfile(src)
......
...@@ -56,4 +56,10 @@ describe Paperclip::AbstractAdapter do ...@@ -56,4 +56,10 @@ describe Paperclip::AbstractAdapter do
it 'is not nil' do it 'is not nil' do
assert !TestAdapter.new.nil? assert !TestAdapter.new.nil?
end end
should 'use the original filename to generate the tempfile' do
@adapter = TestAdapter.new
@adapter.original_filename = "file.png"
assert @adapter.send(:destination).path.ends_with?(".png")
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment