You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug occurs when using email addresses encoded as the user (i.e: rtsp://user%40name:pass@foo.bar/foo.mkv)
The solution is simply to use the getEncodedAuthority method instead of getAuthority. This resolves the issue because getAuthority decodes the encoded "@" symbols before splitting, resulting in a malformed URL.
Malformed URL example: rtsp://name:pass/foo.mkv
After the fix, it properly returns: rtsp://foo.bar/foo.mkv
Instead of manually splitting the encoded authority on @ in order to remove the user-info and leave just the host and port, I wonder if it would instead be better to manually concatenate uri.getHost() and uri.getPort(). Then we let the Uri class deal with the splitting and encoding issues. Would that still allow your test case to pass?
The removeUserInfo method is used with the confidence that it will only remove that part since some URLs not only contain host and port but also path, query parameters, etc. The current issue of certain %40 being converted to @ has been resolved, allowing emails to be used as usernames in the user information.
I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!
This file contains hidden or 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
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.
This bug occurs when using email addresses encoded as the user (i.e:
rtsp://user%40name:pass@foo.bar/foo.mkv)The solution is simply to use the
getEncodedAuthoritymethod instead ofgetAuthority. This resolves the issue because getAuthority decodes the encoded "@" symbols before splitting, resulting in a malformed URL.Malformed URL example:
rtsp://name:pass/foo.mkvAfter the fix, it properly returns:
rtsp://foo.bar/foo.mkv