Skip to content

Fixed removal of user info for URLs that contain encoded @ characters #1138

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
* DASH Extension:
* Smooth Streaming Extension:
* RTSP Extension:
* Fix user info removal for URLs that contain encoded @ characters
([#1138](https://github.com/androidx/media/pull/1138)).
* Decoder Extensions (FFmpeg, VP9, AV1, etc.):
* MIDI extension:
* Leanback extension:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static Uri removeUserInfo(Uri uri) {
}

// The Uri must include a "@" if the user info is non-null.
String authorityWithUserInfo = checkNotNull(uri.getAuthority());
String authorityWithUserInfo = checkNotNull(uri.getEncodedAuthority());
checkArgument(authorityWithUserInfo.contains("@"));
String authority = Util.split(authorityWithUserInfo, "@")[1];
return uri.buildUpon().encodedAuthority(authority).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,12 @@ public void removeUserInfo_withNoUserInfo() {
.isEqualTo(Uri.parse("rtsp://foo.bar:5050/foo.mkv"));
}

@Test
public void removeUserInfo_withEncodedAtInUserInfo() {
Uri uri = Uri.parse("rtsp://user%40name:pass@foo.bar/foo.mkv");
assertThat(RtspMessageUtil.removeUserInfo(uri)).isEqualTo(Uri.parse("rtsp://foo.bar/foo.mkv"));
}

@Test
public void parseContentLengthHeader_withContentLengthOver31Bits_succeeds() throws Exception {
String line = "Content-Length: 1000000000000000";
Expand Down