decode urls before reencoding with NSURL #39344
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog: [Internal]
in ios 17, NSURLs are encoded respecting RFC 3986 (https://www.ietf.org/rfc/rfc3986.txt) as opposed to RFC 1738/1808 before.
following this,
NSURL
's parsing algorithm has changed such that if they encounter a reserved character, such as[
, the parser will percent encode all possible characters in the url, including%
.this causes trouble for urls that already have some encoding. for the string
%22[]
, the new parsing algorithm will return the following:RFC 1738/1808 ->
%22%5B%5D
RFC 3986 ->
%2522%5B%5D
(invalid encoding)the solution here is to decode all the percentified encodings in the input string, completely stripping it of the percent encodings, and then re-encoding it. thus, the string will transform as follows:
%22[]
->"[]
->%22%5B%5D
we probably don't need the OS check, but including it just to be safe.
Differential Revision: D49082077