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

Fetching ETAG fails if filename contains whitespace #828

Closed
janpieper opened this issue May 28, 2015 · 1 comment
Closed

Fetching ETAG fails if filename contains whitespace #828

janpieper opened this issue May 28, 2015 · 1 comment

Comments

@janpieper
Copy link
Contributor

require "aws-sdk"

s3_client = Aws::S3::Client.new({
  :access_key_id => "...",
  :secret_access_key => "...",
  :region => "eu-central-1"
})

s3_bucket = Aws::S3::Bucket.new(
  name: "...",
  client: s3_client
)

s3_bucket.objects(prefix: "files/").each do |object_summary|
  puts object_summary.object.key
  puts object_summary.object.etag
end

Calling #key works fine, but if you call #etag an Aws::S3::Errors::NotFound error will be raised.

jan@svadlupnir ~/ $ aws-cli/1.7.0 Python/2.7.6 Linux/3.13.0-40-generic
aws-cli/1.7.0 Python/2.7.6 Linux/3.13.0-40-generic

jan@svadlupnir ~/ $ aws s3 ls s3://bucket/files/
2015-04-23 14:40:34    1433387 fille%20with%20whitespace.pdf
/home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call': Aws::S3::Errors::NotFound
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:18:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/seahorse/client/plugins/param_conversion.rb:22:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/seahorse/client/plugins/response_target.rb:18:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/seahorse/client/request.rb:70:in `send_request'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/seahorse/client/base.rb:216:in `block (2 levels) in define_operation_methods'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/request.rb:24:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/operations.rb:41:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/operations.rb:61:in `call'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/resource.rb:147:in `load'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/resource.rb:120:in `data'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/resource.rb:223:in `block in add_data_attribute'
        from example.rb:16:in `block in <main>'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/batch.rb:75:in `each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/batch.rb:75:in `each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/batch.rb:75:in `each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/collection.rb:18:in `block in each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/operations.rb:128:in `block in all_batches'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-core-2.0.42/lib/aws-sdk-core/pageable_response.rb:77:in `each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/operations.rb:127:in `all_batches'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/collection.rb:18:in `each'
        from /home/jan/.rvm/gems/ruby-2.1.5/gems/aws-sdk-resources-2.0.42/lib/aws-sdk-resources/collection.rb:18:in `each'
        from example.rb:14:in `<main>'
@trevorrowe
Copy link
Member

Thanks for reporting the issue! I've corrected the unit test that was covering this and added an integration test to exercise this against Amazon S3.

@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