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

Copy fails if the file name has two simultaneous spaces #86

Open
k6s3 opened this issue Jan 24, 2014 · 4 comments
Open

Copy fails if the file name has two simultaneous spaces #86

k6s3 opened this issue Jan 24, 2014 · 4 comments
Labels

Comments

@k6s3
Copy link

k6s3 commented Jan 24, 2014

I've implemented a direct to s3 file upload mechanism, where the file first gets uploaded to the bucket root and then gets copied over to its final resting place using a copy command..

The copy fails if the file name has two spaces, as illustrated below -

1.9.3p484 :052 > s3_object_1 = artifact.attachment.bucket.objects.find("a  b.pdf")
 => #<S3::Object:/my-bucket/a  b.pdf> 
1.9.3p484 :053 > s3_object_1.copy(:key => "copy_of_file_1.pdf", :acl => :private)
S3::Error::SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/connection.rb:217:in `handle_response'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/connection.rb:204:in `send_request'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/connection.rb:89:in `request'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/service.rb:74:in `service_request'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/bucket.rb:171:in `bucket_request'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/object.rb:160:in `copy_object'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/s3-0.3.11/lib/s3/object.rb:98:in `copy'
  from (irb):53
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands/console.rb:47:in `start'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in `start'
  from /home/user_name/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'
1.9.3p484 :054 > s3_object_2 = artifact.attachment.bucket.objects.find("x y.pdf")
 => #<S3::Object:/my-bucket/x y.pdf> 
1.9.3p484 :055 > s3_object_2.copy(:key => "copy_of_file_2.pdf", :acl => :private)
 => #<S3::Object:/my-bucket/copy_of_file_2.pdf>

The data setup is proper, "a b.pdf" (note doublespaces) and "x y.pdf" files exist in the same bucket as artifact.attachment ("artifact" is a rails active record object)

@qoobaa
Copy link
Owner

qoobaa commented Jan 24, 2014

Does it work with filenames without spaces?

@k6s3
Copy link
Author

k6s3 commented Jan 24, 2014

Yes, it works with filenames without spaces..

Regards,

Kaushik Shah
+91 9920 511 571

On Fri, Jan 24, 2014 at 3:13 PM, Kuba Kuźma notifications@github.comwrote:

Does it work with filenames without spaces?


Reply to this email directly or view it on GitHubhttps://github.com//issues/86#issuecomment-33209449
.

@qoobaa
Copy link
Owner

qoobaa commented Jan 24, 2014

Hm. It seems like a problem with escaping strings when calculating signatures. Do you have some time to fix it?

@k6s3
Copy link
Author

k6s3 commented Jan 24, 2014

Sure, I'll try to fix it over the next couple of days.

On Fri, Jan 24, 2014 at 3:45 PM, Kuba Kuźma notifications@github.comwrote:

Hm. It seems like a problem with escaping strings when calculating
signatures. Do you have some time to fix it?


Reply to this email directly or view it on GitHubhttps://github.com//issues/86#issuecomment-33211408
.

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

No branches or pull requests

2 participants