Commit ea62bcb1 by Mike Mangino Committed by Jon Yurek

Handle empty filenames

parent 7ef5d0e4
...@@ -34,7 +34,7 @@ module Paperclip ...@@ -34,7 +34,7 @@ module Paperclip
private private
def destination def destination
@destination ||= TempfileFactory.new.generate(@original_filename) @destination ||= TempfileFactory.new.generate(@original_filename.to_s)
end end
def copy_to_tempfile(src) def copy_to_tempfile(src)
......
...@@ -57,6 +57,11 @@ describe Paperclip::AbstractAdapter do ...@@ -57,6 +57,11 @@ describe Paperclip::AbstractAdapter do
assert !TestAdapter.new.nil? assert !TestAdapter.new.nil?
end end
should "can generate a destination filename with no original filename" do
@adapter = TestAdapter.new
assert_not_nil @adapter.send(:destination).path
end
should 'use the original filename to generate the tempfile' do should 'use the original filename to generate the tempfile' do
@adapter = TestAdapter.new @adapter = TestAdapter.new
@adapter.original_filename = "file.png" @adapter.original_filename = "file.png"
......
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