-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decode urls before reencoding with NSURL #39344
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
p: Facebook
Partner: Facebook
Partner
labels
Sep 8, 2023
This pull request was exported from Phabricator. Differential Revision: D49082077 |
This pull request was exported from Phabricator. Differential Revision: D49082077 |
philIip
force-pushed
the
export-D49082077
branch
from
September 8, 2023 19:57
1c220d4
to
df8722f
Compare
philIip
added a commit
to philIip/react-native
that referenced
this pull request
Sep 8, 2023
Summary: ## Changelog: [iOS][General] - URLs parsed by RCTConvert should be encoded respecting RFC 3986, 1738/1808 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. Reviewed By: yungsters Differential Revision: D49082077
Summary: ## Changelog: [iOS][General] - URLs parsed by RCTConvert should be encoded respecting RFC 3986, 1738/1808 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. Reviewed By: yungsters Differential Revision: D49082077
philIip
force-pushed
the
export-D49082077
branch
from
September 8, 2023 19:58
df8722f
to
bf9c8dc
Compare
This pull request was exported from Phabricator. Differential Revision: D49082077 |
This pull request was successfully merged by @philIip in 9841bd8. When will my fix make it into a release? | Upcoming Releases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
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