{"action":"created","comment":{"url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/comments/46312504","id":46312504,"diff_hunk":"@@ -79,30 +79,59 @@ public static String getRealPath(String uriString, CordovaInterface cordova) {\n     @SuppressLint(\"NewApi\")\n     public static String getRealPathFromURI_API19(Context context, Uri uri) {\n         String filePath = \"\";\n+\n         try {\n-            String wholeID = DocumentsContract.getDocumentId(uri);\n+            String id;\n+\n+            if (DocumentsContract.isDocumentUri(context, uri)) {\n+                String wholeID = DocumentsContract.getDocumentId(uri);\n \n-            // Split at colon, use second item in the array\n-            String id = wholeID.indexOf(\":\") > -1 ? wholeID.split(\":\")[1] : wholeID.indexOf(\";\") > -1 ? wholeID\n-                    .split(\";\")[1] : wholeID;\n+                // Split at colon, use second item in the array\n+                id = wholeID.indexOf(\":\") > -1\n+                        ? wholeID.split(\":\")[1]\n+                        : wholeID.indexOf(\";\") > -1\n+                        ? wholeID.split(\";\")[1]\n+                        : wholeID;\n+            } else {\n+                final String uriStr = uri.toString();\n+\n+                if (","path":"src/android/FileHelper.java","position":24,"original_position":24,"commit_id":"c09a8cf09b371c6071256444b81b18c10b3b70af","original_commit_id":"c09a8cf09b371c6071256444b81b18c10b3b70af","user":{"login":"riknoll","id":13754588,"avatar_url":"https://avatars.githubusercontent.com/u/13754588?v=3","gravatar_id":"","url":"https://api.github.com/users/riknoll","html_url":"https://github.com/riknoll","followers_url":"https://api.github.com/users/riknoll/followers","following_url":"https://api.github.com/users/riknoll/following{/other_user}","gists_url":"https://api.github.com/users/riknoll/gists{/gist_id}","starred_url":"https://api.github.com/users/riknoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riknoll/subscriptions","organizations_url":"https://api.github.com/users/riknoll/orgs","repos_url":"https://api.github.com/users/riknoll/repos","events_url":"https://api.github.com/users/riknoll/events{/privacy}","received_events_url":"https://api.github.com/users/riknoll/received_events","type":"User","site_admin":false},"body":"Nitpick: maybe collapse the `if` statement to a single line (matches the style of the file better). ","created_at":"2015-12-01T17:53:28Z","updated_at":"2015-12-01T17:53:28Z","html_url":"https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46312504","pull_request_url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/comments/46312504"},"html":{"href":"https://github.com/apache/cordova-plugin-camera/pull/141#discussion_r46312504"},"pull_request":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141","id":52174592,"html_url":"https://github.com/apache/cordova-plugin-camera/pull/141","diff_url":"https://github.com/apache/cordova-plugin-camera/pull/141.diff","patch_url":"https://github.com/apache/cordova-plugin-camera/pull/141.patch","issue_url":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/141","number":141,"state":"open","locked":false,"title":"[CB-10093][android] fix failure to get image from gallery, caused by the uri passed into outputModifiedBitmap() is not a document URI","user":{"login":"sencenan","id":1971049,"avatar_url":"https://avatars.githubusercontent.com/u/1971049?v=3","gravatar_id":"","url":"https://api.github.com/users/sencenan","html_url":"https://github.com/sencenan","followers_url":"https://api.github.com/users/sencenan/followers","following_url":"https://api.github.com/users/sencenan/following{/other_user}","gists_url":"https://api.github.com/users/sencenan/gists{/gist_id}","starred_url":"https://api.github.com/users/sencenan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sencenan/subscriptions","organizations_url":"https://api.github.com/users/sencenan/orgs","repos_url":"https://api.github.com/users/sencenan/repos","events_url":"https://api.github.com/users/sencenan/events{/privacy}","received_events_url":"https://api.github.com/users/sencenan/received_events","type":"User","site_admin":false},"body":"fixing: https://issues.apache.org/jira/browse/CB-10093\r\n\r\nfiles picked from the Gallery app is in the format of\r\n\r\n```\r\ncontent://media/external/images/media/117209\r\n```\r\n\r\nThis would cause ```DocumentsContract.getDocumentId``` to throw exception. [See](http://grepcode.com/file/repo1.maven.org/maven2/org.robolectric/android-all/4.4_r1-robolectric-1/android/provider/DocumentsContract.java#619)\r\n\r\nThis patch fixes it.","created_at":"2015-11-30T20:27:51Z","updated_at":"2015-12-01T17:53:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99eda94417b215764adbdff1585a5def5760e8b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141/commits","review_comments_url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141/comments","review_comment_url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/141/comments","statuses_url":"https://api.github.com/repos/apache/cordova-plugin-camera/statuses/c09a8cf09b371c6071256444b81b18c10b3b70af","head":{"label":"sencenan:master","ref":"master","sha":"c09a8cf09b371c6071256444b81b18c10b3b70af","user":{"login":"sencenan","id":1971049,"avatar_url":"https://avatars.githubusercontent.com/u/1971049?v=3","gravatar_id":"","url":"https://api.github.com/users/sencenan","html_url":"https://github.com/sencenan","followers_url":"https://api.github.com/users/sencenan/followers","following_url":"https://api.github.com/users/sencenan/following{/other_user}","gists_url":"https://api.github.com/users/sencenan/gists{/gist_id}","starred_url":"https://api.github.com/users/sencenan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sencenan/subscriptions","organizations_url":"https://api.github.com/users/sencenan/orgs","repos_url":"https://api.github.com/users/sencenan/repos","events_url":"https://api.github.com/users/sencenan/events{/privacy}","received_events_url":"https://api.github.com/users/sencenan/received_events","type":"User","site_admin":false},"repo":{"id":47143693,"name":"cordova-plugin-camera","full_name":"sencenan/cordova-plugin-camera","owner":{"login":"sencenan","id":1971049,"avatar_url":"https://avatars.githubusercontent.com/u/1971049?v=3","gravatar_id":"","url":"https://api.github.com/users/sencenan","html_url":"https://github.com/sencenan","followers_url":"https://api.github.com/users/sencenan/followers","following_url":"https://api.github.com/users/sencenan/following{/other_user}","gists_url":"https://api.github.com/users/sencenan/gists{/gist_id}","starred_url":"https://api.github.com/users/sencenan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sencenan/subscriptions","organizations_url":"https://api.github.com/users/sencenan/orgs","repos_url":"https://api.github.com/users/sencenan/repos","events_url":"https://api.github.com/users/sencenan/events{/privacy}","received_events_url":"https://api.github.com/users/sencenan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sencenan/cordova-plugin-camera","description":"Mirror of Apache Cordova Plugin camera","fork":true,"url":"https://api.github.com/repos/sencenan/cordova-plugin-camera","forks_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/forks","keys_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/teams","hooks_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/hooks","issue_events_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/issues/events{/number}","events_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/events","assignees_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/assignees{/user}","branches_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/branches{/branch}","tags_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/tags","blobs_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/git/refs{/sha}","trees_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/statuses/{sha}","languages_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/languages","stargazers_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/stargazers","contributors_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/contributors","subscribers_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/subscribers","subscription_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/subscription","commits_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/commits{/sha}","git_commits_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/git/commits{/sha}","comments_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/comments{/number}","issue_comment_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/issues/comments{/number}","contents_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/contents/{+path}","compare_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/merges","archive_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/downloads","issues_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/issues{/number}","pulls_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/pulls{/number}","milestones_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/milestones{/number}","notifications_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/labels{/name}","releases_url":"https://api.github.com/repos/sencenan/cordova-plugin-camera/releases{/id}","created_at":"2015-11-30T20:20:48Z","updated_at":"2015-11-30T20:20:49Z","pushed_at":"2015-11-30T20:21:54Z","git_url":"git://github.com/sencenan/cordova-plugin-camera.git","ssh_url":"git@github.com:sencenan/cordova-plugin-camera.git","clone_url":"https://github.com/sencenan/cordova-plugin-camera.git","svn_url":"https://github.com/sencenan/cordova-plugin-camera","homepage":null,"size":860,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"ef5484a2aa72e63c2ad95d5533db6f25ed53e5c7","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":10860591,"name":"cordova-plugin-camera","full_name":"apache/cordova-plugin-camera","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cordova-plugin-camera","description":"Mirror of Apache Cordova Plugin camera","fork":false,"url":"https://api.github.com/repos/apache/cordova-plugin-camera","forks_url":"https://api.github.com/repos/apache/cordova-plugin-camera/forks","keys_url":"https://api.github.com/repos/apache/cordova-plugin-camera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cordova-plugin-camera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cordova-plugin-camera/teams","hooks_url":"https://api.github.com/repos/apache/cordova-plugin-camera/hooks","issue_events_url":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cordova-plugin-camera/events","assignees_url":"https://api.github.com/repos/apache/cordova-plugin-camera/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cordova-plugin-camera/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cordova-plugin-camera/tags","blobs_url":"https://api.github.com/repos/apache/cordova-plugin-camera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cordova-plugin-camera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cordova-plugin-camera/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cordova-plugin-camera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cordova-plugin-camera/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cordova-plugin-camera/languages","stargazers_url":"https://api.github.com/repos/apache/cordova-plugin-camera/stargazers","contributors_url":"https://api.github.com/repos/apache/cordova-plugin-camera/contributors","subscribers_url":"https://api.github.com/repos/apache/cordova-plugin-camera/subscribers","subscription_url":"https://api.github.com/repos/apache/cordova-plugin-camera/subscription","commits_url":"https://api.github.com/repos/apache/cordova-plugin-camera/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cordova-plugin-camera/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cordova-plugin-camera/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cordova-plugin-camera/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cordova-plugin-camera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cordova-plugin-camera/merges","archive_url":"https://api.github.com/repos/apache/cordova-plugin-camera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cordova-plugin-camera/downloads","issues_url":"https://api.github.com/repos/apache/cordova-plugin-camera/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cordova-plugin-camera/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cordova-plugin-camera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cordova-plugin-camera/labels{/name}","releases_url":"https://api.github.com/repos/apache/cordova-plugin-camera/releases{/id}","created_at":"2013-06-22T07:00:13Z","updated_at":"2015-11-29T09:50:56Z","pushed_at":"2015-12-01T01:57:44Z","git_url":"git://github.com/apache/cordova-plugin-camera.git","ssh_url":"git@github.com:apache/cordova-plugin-camera.git","clone_url":"https://github.com/apache/cordova-plugin-camera.git","svn_url":"https://github.com/apache/cordova-plugin-camera","homepage":null,"size":1489,"stargazers_count":255,"watchers_count":255,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":374,"mirror_url":"git://git.apache.org/cordova-plugin-camera.git","open_issues_count":24,"forks":374,"open_issues":24,"watchers":255,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141"},"html":{"href":"https://github.com/apache/cordova-plugin-camera/pull/141"},"issue":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/141"},"comments":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/apache/cordova-plugin-camera/statuses/c09a8cf09b371c6071256444b81b18c10b3b70af"}}}}