diff --git a/android/titanium/src/java/org/appcelerator/titanium/io/TitaniumBlob.java b/android/titanium/src/java/org/appcelerator/titanium/io/TitaniumBlob.java index 3ab5a45f760..787c73df0b5 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/io/TitaniumBlob.java +++ b/android/titanium/src/java/org/appcelerator/titanium/io/TitaniumBlob.java @@ -86,11 +86,18 @@ protected void init() } else if (url.startsWith("content://com.android.providers.downloads.documents")) { // This was a file downloaded from the Google cloud. String id = DocumentsContract.getDocumentId(Uri.parse(url)); - Uri uri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); - try (Cursor cursor = contentResolver.query(uri, projection, null, null, null)) { - if ((cursor != null) && cursor.moveToNext()) { - this.name = getStringFrom(cursor, 0); - this.path = getStringFrom(cursor, 1); + try { + if (id.startsWith("raw:")) { + this.path = id.substring(4); + this.name = this.path.substring(this.path.lastIndexOf(File.pathSeparatorChar) + 1); + } else { + Uri uri = + ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); + Cursor cursor = contentResolver.query(uri, projection, null, null, null); + if ((cursor != null) && cursor.moveToNext()) { + this.name = getStringFrom(cursor, 0); + this.path = getStringFrom(cursor, 1); + } } } catch (Exception ex) { }