diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java index e20752c6..81032374 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; } }