From 1d238f60c9508cc38a13d7b5a293c56f268d62e8 Mon Sep 17 00:00:00 2001 From: Pavel Petrov Date: Thu, 1 Feb 2024 16:24:26 +0300 Subject: [PATCH] cordova updates, fix issues with cdvfile protocol of read audio on android --- src/android/FileHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java index e20752c62..810323746 100644 --- a/src/android/FileHelper.java +++ b/src/android/FileHelper.java @@ -22,6 +22,9 @@ Licensed to the Apache Software Foundation (ASF) under one public class FileHelper { + private static final String CDVFILE_PREFIX = "cdvfile://localhost/temporary"; + private static final String CDVFILE_PREFIX1 = "cdvfile"; + /** * Removes the "file://" prefix from the given URI string, if applicable. * If the given URI string doesn't have a "file://" prefix, it is returned unchanged. @@ -33,6 +36,9 @@ public static String stripFileProtocol(String uriString) { if (uriString.startsWith("file://")) { return Uri.parse(uriString).getPath(); } + if (uriString.startsWith(CDVFILE_PREFIX) || uriString.startsWith(CDVFILE_PREFIX1)) { + return Uri.parse(uriString).getLastPathSegment(); + } return uriString; } }