qoobaa / s3

Library for accessing S3 objects and buckets, supports EU and US buckets
MIT License
258 stars 112 forks source link

When creating an object first try to GET it #121

Open mustela opened 7 years ago

mustela commented 7 years ago

Guys, I'm trying to create a simple object but when I do it, it first run a GET and of corse since the resource doesn't exists it rise an exception:

s = my_bucket.objects.build "holaaaa/"
s.save
opening connection to my_bucket.s3.amazonaws.com:80...
opened
<- "GET /holaaaa/? HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nDate: Tue, 18 Oct 2016 17:03:03 GMT\r\nAuthorization: AWS xxxxxxx=\r\nHost: my_bucket.s3.amazonaws.com\r\n\r\n"
-> "HTTP/1.1 404 Not Found\r\n"

Is this the expected behavior?

UPDATED: The problem is when you don't set the content of the file.

qoobaa commented 7 years ago

I haven't used it for a while, so I'm not sure if this is an expected behavior. If you think it is, feel free to create a PR with a test case.

mustela commented 7 years ago

It shouldn't really be the expected behavior, will try to work on a PR. Thanks!