Tempfile also can be pushed #116

merged 1 commit into from Mar 23, 2012


None yet
3 participants

rkyrychuk commented Mar 23, 2012

Allow Tempfile upload with valid content-length

Latest paperclip configured with fog has issue on some buckets by uploading 0 sized file.

geemus merged commit 7ead7ba into excon:master Mar 23, 2012

nextmat referenced this pull request Mar 26, 2012


Fix Tempfile bug #117

I'm still seeing this issue, running with excon (0.13.2), fog (1.3.1), paperclip (3.0.1)


geemus commented Apr 4, 2012

@lawrencepit - Sorry to hear it. Could you open a new issue with a stack trace so I can dig into it a bit. Also, please note your Ruby version (just in case that impacts). Thanks!

@geemus Unfortunately there's no stacktrace. As @rkyrychuk mentions in his initial note, it appears to go okay, it's just that the end result is a zero-length file on S3. I use REE.2012.02.


rkyrychuk commented Apr 5, 2012

just tested, paperclip 3.0.1 do this, 3.0.0 works

Indeed, paperclip 3.0.0 works for me too. Thnx, I'll stick to that one for now.


geemus commented Apr 5, 2012

@lawrencepit - @rkyrychuk sent a fix and I have released it as part of 0.13.3

Thnx, works for me!

Unfortunately it turns out it's still not working entirely correctly. Not related to paperclip. It's simply using fog only. The following reproduces the issue:

require 'rubygems'
require 'fog'

  :aws_access_key_id => '<my_aws_access_key_id>',
  :aws_secret_access_key => '<my_aws_secret_access_key>',
  :provider => 'AWS',
  :region => 'us-east-1'

S3_BUCKET = 'my-bucket'

def s3_upload_object(key, data)
  fog_connection = ::Fog::Storage.new(FOG_CREDENTIALS)
  fog_connection.put_object(S3_BUCKET, key, data)

filepath = "test.fog.excon"
File.open(filepath, "w") do |f|
  f.write("foo "*1000)

s3_upload_object(filepath, File.open(filepath, "r"))

# file should be uploaded in S3_BUCKET/test.fog.excon

puts "Done!"

This results in a 0B file on S3. This works fine with previous versions of fog / excon.

Note that this isn't even a tempfile.

ruby ree.2012.02
fog (1.3.1)
excon (0.13.3)


rkyrychuk commented Apr 12, 2012

ruby 1.9.3p0
fog 1.3.1
excon (0.13.3)

All uploaded correctly.
Maybe problem with ruby. Check if your local file is non zero sized

Local file is non zero sized. I also tried with jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8), same issue. Guess all 1.8.7 implementations probably have this issue.

tested with MacRuby 0.10 (ruby 1.9.2): that works okay.


geemus commented Apr 12, 2012

@lawrencepit - thanks for the additional details, I'll poke around and see if I can figure anything out. Just glad we narrowed it down at least a bit (does sound like it must be a 1.8.7 issue).

@geemus thnx for the fix, just confirming it works for me for ree.2012.02 and macruby


geemus commented Apr 16, 2012

@lawrencepit - great, thanks for the update and sorry for all the trouble. I've added tests that upload using files now (for whatever reason this had been overlooked previously and it had just used strings). So with those in place we should hopefully better avoid this kind of thing as the ci box should catch anything in the usual suspects interpreter wise. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment