Permalink
Browse files

Escape all non-unreserved characters

  • Loading branch information...
jcbpl committed Mar 1, 2012
1 parent 570ab50 commit baf145aa3c252388cf4c8d683954aada4809c737
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/s3/object.rb
  2. +1 −1 lib/s3/signature.rb
View
@@ -107,7 +107,7 @@ def destroy
# Returns Object's URL using protocol specified in service,
# e.g. <tt>http://domain.com.s3.amazonaws.com/key/with/path.extension</tt>
def url
- URI.escape("#{protocol}#{host}/#{path_prefix}#{key}")
+ "#{protocol}#{host}/#{path_prefix}#{URI.escape(key, /[^#{URI::REGEXP::PATTERN::UNRESERVED}\/]/)}"
end
# Returns a temporary url to the object that expires on the
View
@@ -54,7 +54,7 @@ def self.generate_temporary_url_signature(options)
headers = options[:headers] || {}
headers.merge!("date" => expires.to_i.to_s)
- options.merge!(:resource => "/#{bucket}/#{URI.escape(resource)}",
+ options.merge!(:resource => "/#{bucket}/#{URI.escape(resource, /[^#{URI::REGEXP::PATTERN::UNRESERVED}\/]/)}",
:method => options[:method] || :get,
:headers => headers)
signature = canonicalized_signature(options)

0 comments on commit baf145a

Please sign in to comment.