Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes a stupid bit of name generation.

  • Loading branch information...
commit 1d775739924444419c73c54899eb87fab1a9c6ff 1 parent 8fdf01a
@jyurek jyurek authored
Showing with 7 additions and 2 deletions.
  1. +2 −2 lib/paperclip/storage/s3.rb
  2. +5 −0 test/storage_test.rb
View
4 lib/paperclip/storage/s3.rb
@@ -127,10 +127,10 @@ def s3_protocol
# 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
View
5 test/storage_test.rb
@@ -351,6 +351,11 @@ class AWS::S3::NoSuchBucket < AWS::S3::ResponseError
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
Please sign in to comment.
Something went wrong with that request. Please try again.