-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Steps to reproduce
base_url = 'https://adrl.test/resources?filter[keywords]=fruit&page[number]=2&page[size]=3
BerkeleyLibrary::Util::URIs.append(base_url, '?filter[foo]=bar')Expected
Either:
-
raise
URI::InvalidComponentError(might be too strict? see RFC 3986 §3.4), or -
convert the
?to something legal, as:#<URI::HTTPS https://adrl.test/resources?filter[keywords]=fruit&page[number]=2&page[size]=3&filter[foo]=bar>(probably too magical)
or
#<URI::HTTPS https://adrl.test/resources?filter[foo]=bar&filter[keywords]=fruit&page[number]=2&page[size]=3>(maybe in the spirit of the way we allow appending path segments to a URL that already has a query?)
Actual
-
returns
#<URI::HTTPS https://adrl.test/resources?filter[keywords]=fruit&page[number]=2&page[size]=3filter[foo]=bar>with
?deleted, so the appended text gets run into the last parameter value.
Notes
Note that this does not happen if you just append filter[foo]=bar without the ?; in that case it gets treated as an additional path component, and you get a somewhat cryptic InvalidComponentError:
bad component(expected absolute path component): /resources/filter[foo]=bar (URI::InvalidComponentError)
(not our message, it's generated by URI::Generic#check_path)
Metadata
Metadata
Assignees
Labels
No labels