Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key with leading slash #69

Open
pdtpatrick opened this issue Dec 24, 2012 · 1 comment
Open

Key with leading slash #69

pdtpatrick opened this issue Dec 24, 2012 · 1 comment

Comments

@pdtpatrick
Copy link

Hi - was wondering whether anyone come across an issue where if you key starts with "/" , you get back AWS::S3::NoSuchKey .

Thanks,

Patrick

@rborkows
Copy link

rborkows commented Aug 7, 2013

Yep, just hit that myself. S3Object.find works fine, but .value returns NoSuchKey

Problem appears to be in lib/aws/s3/object.rb path!
This bit: '/' << File.join(bucket_name(bucket), name)

File.join strips leading slashes, leading to the following unexpected result:
irb(main):110:0> File.join "something", "something2"
=> "something/something2"
irb(main):111:0> File.join "something", "/something2"
=> "something/something2"

I worked around it like so:
AWS::S3::S3Object.get("/bucketname//subdir/myfile")

Basically you have to form the path yourself to work around this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants