-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Description
version: 2.5.2
When call normalize
, single quote (%27
) in query string will decode to '
. Is this expected behavior?
4.2.8@2.3.3 (main)> uri = Addressable::URI.parse("https://お名前.com/ほげ/ふが.jpg")
=> #<Addressable::URI:0x5c1cb04 URI:https://お名前.com/ほげ/ふが.jpg>
4.2.8@2.3.3 (main)> uri.normalize
=> #<Addressable::URI:0x5b475e4 URI:https://xn--t8jx73hngb.com/%E3%81%BB%E3%81%92/%E3%81%B5%E3%81%8C.jpg>
4.2.8@2.3.3 (main)> uri.to_s
=> "https://お名前.com/ほげ/ふが.jpg"
4.2.8@2.3.3 (main)> que = {}
=> {}
4.2.8@2.3.3 (main)> que[:'response-content-disposition'] = "attachment;filename*=UTF-8''ふが.jpg"
=> "attachment;f;filename*=UTF-8''\xE3\x81\xB5\xE3\x81\x8C.jpg"
4.2.8@2.3.3 (main)> uri.query_values = que
=> {
:"response-content-disposition" => "attachment;filename*=UTF-8''\xE3\x81\xB5\xE3\x81\x8C.jpg"
}
4.2.8@2.3.3 (main)> uri.to_s
=> "https://お名前.com/ほげ/ふが.jpg?response-content-disposition=attachment%3Bfilename%2A%3DUTF-8%27%27%E3%81%B5%E3%81%8C.jpg"
4.2.8@2.3.3 (main)> uri.normalize
=> #<Addressable::URI:0x80aeb5c URI:https://xn--t8jx73hngb.com/%E3%81%BB%E3%81%92/%E3%81%B5%E3%81%8C.jpg?response-content-disposition=attachment%3Bfilename*=UTF-8''%E3%81%B5%E3%81%8C.jpg>
As workaround, I manually concatenate each parts. Is there any better way?
4.2.8@2.3.3 (main)> uri.scheme + "://" + uri.normalized_host + uri.normalized_path + "?" + uri.query
=> "https://xn--t8jx73hngb.com/%E3%81%BB%E3%81%92/%E3%81%B5%E3%81%8C.jpg?response-content-disposition=attachment%3Bf%3Bfilename%2A%3DUTF-8%27%27%E3%81%B5%E3%81%8C.jpg"
Metadata
Metadata
Assignees
Labels
No labels