File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,8 @@ def blob_exist?(key, options = {})
194194 #
195195 # Returns a hash of the blob's tags.
196196 def get_blob_tags ( key )
197- uri = generate_uri ( "#{ container } /#{ key } ?comp=tags" )
197+ uri = generate_uri ( "#{ container } /#{ key } " )
198+ uri . query = URI . encode_www_form ( comp : "tags" )
198199 response = Http . new ( uri , signer :) . get
199200
200201 Tags . from_response ( response ) . to_h
@@ -246,7 +247,8 @@ def delete_container(options = {})
246247 #
247248 # Example: +generate_uri("#{container}/#{key}")+
248249 def generate_uri ( path )
249- URI . parse ( URI ::RFC2396_PARSER . escape ( File . join ( host , path ) ) )
250+ encoded = path . split ( "/" ) . map { |segment | CGI . escape ( segment ) } . join ( "/" )
251+ URI . parse ( [ host . chomp ( "/" ) , encoded ] . join ( "/" ) )
250252 end
251253
252254 # Returns an SAS signed URI
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def setup
2323 host : @host ,
2424 )
2525 @uid = SecureRandom . uuid
26- @key = "test-client-#{ name } -#{ @uid } "
26+ @key = "test-client-?- #{ name } -#{ @uid } " # ? in key to test proper escaping
2727 @content = "Some random content #{ Random . rand ( 200 ) } "
2828 end
2929
You can’t perform that action at this time.
0 commit comments