fix(YouTube - Sanitize sharing links): Handle non hierarchical urls

This commit is contained in:
LisoUseInAIKyrios
2025-11-12 20:55:32 +02:00
parent 98371be33c
commit 654d091e65

View File

@@ -35,6 +35,15 @@ public class LinkSanitizer {
public Uri sanitizeUri(Uri uri) {
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();
if (!parametersToRemove.isEmpty()) {