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

Trailing slash on key is lost #762

Closed
emil-rb opened this issue Apr 2, 2015 · 1 comment
Closed

Trailing slash on key is lost #762

emil-rb opened this issue Apr 2, 2015 · 1 comment

Comments

@emil-rb
Copy link

emil-rb commented Apr 2, 2015

Problem

When using a trailing slash in the key the slash gets lost.

s3client = Aws::S3::Client.new(...)
s3client.put_object(key: 'path/with/trailing/slash/', bucket: 'bucket', body: '')

Actual behavior

An empty object with key path/with/trailing/slash is created.

Expected behavior

Create an empty object with key path/with/trailing/slash/ (note the trailing slash).

Use case

The use case for this is s3fs. It uses empty objects with trailing slashes to mark directories. Due to this issue objects created with this sdk are unusable from s3fs.

Debugging

I managed to track down the problematic piece of code.
aws-sdk-core/lib/seahorse/client/plugins/endpoint.rb, line 61:

param.split('/').map{ |value| escape(value) }.join('/')

This split-then-join loses the trailing slash.

@trevorrowe
Copy link
Member

Thank you for the bug report and the pointer to the cause. I've put together a fix and added a test to cover the expected behavior. This should go out with the next release shortly.

@srchase srchase added the bug label Dec 24, 2018
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

3 participants