mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-09 10:53:55 +01:00
fix(YouTube - Sanitize sharing links): Handle non hierarchical urls
This commit is contained in:
@@ -35,6 +35,15 @@ public class LinkSanitizer {
|
|||||||
|
|
||||||
public Uri sanitizeUri(Uri uri) {
|
public Uri sanitizeUri(Uri uri) {
|
||||||
try {
|
try {
|
||||||
|
String scheme = uri.getScheme();
|
||||||
|
if (scheme == null || !(scheme.equals("http") || scheme.equals("https"))) {
|
||||||
|
// Opening YouTube share sheet 'other' option passes the video title as a URI.
|
||||||
|
// Checking !uri.isHierarchical() works for all cases, except if the
|
||||||
|
// video title starts with / and then it's hierarchical but still an invalid URI.
|
||||||
|
Logger.printDebug(() -> "Ignoring uri: " + uri);
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
Uri.Builder builder = uri.buildUpon().clearQuery();
|
Uri.Builder builder = uri.buildUpon().clearQuery();
|
||||||
|
|
||||||
if (!parametersToRemove.isEmpty()) {
|
if (!parametersToRemove.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user