flexera-public / right_aws

RightScale Amazon Web Services Ruby Gems
MIT License
451 stars 175 forks source link

Incorrect escaping of unicode with ruby 1.9.3 #140

Closed tvongaza closed 6 years ago

tvongaza commented 12 years ago

Given a param of "document_versions/65/unicode - レミ" amz_escape will incorrectly escape only the first byte of the unicode characters. This is due to $.size returning the strings character length in 1.9 vs the strings byte length. Changing $1.size to $1.bytesize fixes the issue.

The regex change removes the following warning: /right_aws-3.0.4/lib/awsbase/right_awsbase.rb:50: warning: regexp match /.../n against to UTF-8 string

Code works in both 1.9.3 and 1.8.7.

klochner commented 11 years ago

Without this patch I also get an incorrect siguature:

RightAws::AwsError: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.