You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/07/05 22:16:27 UTC
[GitHub] jcesarmobile closed pull request #322: CB-14097: (android) Fix
crash when selecting some files with getPicture
jcesarmobile closed pull request #322: CB-14097: (android) Fix crash when selecting some files with getPicture
URL: https://github.com/apache/cordova-plugin-camera/pull/322
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java
index ccc5e3e7..edf16578 100644
--- a/src/android/FileHelper.java
+++ b/src/android/FileHelper.java
@@ -97,10 +97,21 @@ public static String getRealPathFromURI_API11_And_Above(final Context context, f
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
- final Uri contentUri = ContentUris.withAppendedId(
- Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
-
- return getDataColumn(context, contentUri, null, null);
+ if (id != null && id.length() > 0) {
+ if (id.startsWith("raw:")) {
+ return id.replaceFirst("raw:", "");
+ }
+ try {
+ final Uri contentUri = ContentUris.withAppendedId(
+ Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
+
+ return getDataColumn(context, contentUri, null, null);
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ } else {
+ return null;
+ }
}
// MediaProvider
else if (isMediaDocument(uri)) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org