Skip to content

fix: URL-encode name and prefix query parameters - #449

Open
pcbeingused33 wants to merge 1 commit into
crowdin:masterfrom
pcbeingused33:fix/c8106-encode-name-prefix
Open

pcbeingused33 wants to merge 1 commit into
crowdin:masterfrom
pcbeingused33:fix/c8106-encode-name-prefix

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

appendUrlParams percent-encodes the free-text query parameters search, filter and croql, but still concatenates name and prefix as they are. listBranches filters by branch name, listReportArchives filters by archive name, and listApplicationKvRecords filters by key prefix. A space in any of those values makes URI.create throw IllegalArgumentException before the request is sent. An & is treated as a query separator, so the value is truncated, and + is read as a space by the server.

name and prefix are now encoded with the existing RequestEncoder.encodeSpaces helper, the same one already used for orderBy, search, filter and croql. Other parameters are unchanged, so an already encoded orderBy is not encoded twice.

Callers who currently encode name or prefix themselves as a workaround should now pass them unencoded. The helper encodes the whole value, including : in prefixes such as user:1:; a server that decodes the query string receives the original text.

A new case in HttpClientTest covers reserved characters in name and prefix next to an already encoded orderBy. It fails without the change.

AI assistance was used to prepare the patch and regression test.

listBranches, listReportArchives and listApplicationKvRecords send
name and prefix through appendUrlParams without encoding. A space
makes URI.create throw IllegalArgumentException, and '&' is read as
a query separator. Encode both with RequestEncoder.encodeSpaces, the
helper already used for search, filter and croql.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant