Commit 1d775739 by Jon Yurek

Fixes a stupid bit of name generation.

parent 8fdf01ab
......@@ -127,10 +127,10 @@ module Paperclip
# style, in the format most representative of the current storage.
def to_file style = default_style
return @queued_for_write[style] if @queued_for_write[style]
filename = path(style).split(".")
filename = path(style)
extname = File.extname(filename)
basename = File.basename(filename, extname)
file = Tempfile.new(basename, extname)
file = Tempfile.new([basename, extname])
file.write(AWS::S3::S3Object.value(path(style), bucket_name))
file.rewind
return file
......
......@@ -351,6 +351,11 @@ class StorageTest < Test::Unit::TestCase
should "be on S3" do
assert true
end
should "generate a tempfile with the right name" do
file = @dummy.avatar.to_file
assert_match /^original.*\.png$/, File.basename(file.path)
end
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