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 = {})
194
194
#
195
195
# Returns a hash of the blob's tags.
196
196
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" )
198
199
response = Http . new ( uri , signer :) . get
199
200
200
201
Tags . from_response ( response ) . to_h
@@ -246,7 +247,8 @@ def delete_container(options = {})
246
247
#
247
248
# Example: +generate_uri("#{container}/#{key}")+
248
249
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 ( "/" ) )
250
252
end
251
253
252
254
# Returns an SAS signed URI
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def setup
23
23
host : @host ,
24
24
)
25
25
@uid = SecureRandom . uuid
26
- @key = "test-client-#{ name } -#{ @uid } "
26
+ @key = "test-client-?- #{ name } -#{ @uid } " # ? in key to test proper escaping
27
27
@content = "Some random content #{ Random . rand ( 200 ) } "
28
28
end
29
29
You can’t perform that action at this time.
0 commit comments