[ 
https://issues.apache.org/jira/browse/CB-7024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14050365#comment-14050365
 ] 

Ian Clelland commented on CB-7024:
----------------------------------

I'm trying to find a way to reproduce this, but I think I need some more 
information.

The message you're seeing about the MANAGE_DOCUMENTS permission suggests that 
you are testing this on Android KitKat -- can you tell me specifically what 
version you are running?

Also, what versions of the Camera, File and FileTransfer plugin are you using? 
If they're not the most current versions, then have you tried to upgrade them?

I haven't been able to reproduce the first issue you mentioned -- when I use 
the Camera plugin to get an image, whether from the Camera or from the photo 
album, I get a FileEntry object that I can call {{file()}} on successfully. How 
are you getting the image that is failing, and what is it's URL? (Ideally, I'd 
like to know what {{fileEntry.toURL()}} and {{fileEntry.toInternalURL())}} are 
returning)

When you next mention that you are having problems with PDF files, I'm not sure 
what the connection is to the camera API -- if you're not using that, then how 
are you getting the URL of the file to pass to FileTransfer (and what exactly 
are you passing to {{FileTransfer.upload()}}?)


> Cordova resolveLocalFileSystemURL works but then fileEntry.file() fails
> -----------------------------------------------------------------------
>
>                 Key: CB-7024
>                 URL: https://issues.apache.org/jira/browse/CB-7024
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>    Affects Versions: 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0, 3.5.0
>         Environment: Android
>            Reporter: DotNetWise
>            Priority: Blocker
>              Labels: file, mimeType, security
>   Original Estimate: 8m
>  Remaining Estimate: 8m
>
> First, you do a {{navigator.camera.getPicture(uploadPicture_step1, 
> uploadError, chooseOptions);}}
> with success and then you do {{window.resolveLocalFileSystemURL(fileURI, 
> function (fileEntry) {})}}
> again with success.
> Now if you call that {{fileEntry.file(function(info) {}, function(err) { 
> });}} you always get an exception and the error callback is called with 
> {{err.code = 1000}};
> The error in {{logcat}} is missing {{android.permission.MANAGE_DOCUMENTS}}
> That is stuppid! It's a bug.
> I cannot get the mime-Type for the given fileEntry, so how am I supposed to 
> upload it via FileTransfer plugin (as it asks explicitely for it - to send it 
> as ContentType to the server - that's another stuppid thing, it should detect 
> it if I pass null in the firs place anways).
> This issue is for the files that are comming from custom providers such as 
> "downloads". e.g. 
> {{content://document/primary%3ADownload/11june.pdf}}
> In config.xml I do have 
> {code}
> <preference name="AndroidExtraFilesystems" 
> value="files,files-external,documents,sdcard,cache,cache-external,root" />
> <feature name="File">
>     <param name="android-package" value="org.apache.cordova.file.FileUtils" />
>     <param name="onload" value="true" />
>   </feature>
>   <feature name="FileTransfer">
>     <param name="android-package" 
> value="org.apache.cordova.filetransfer.FileTransfer" />
>   </feature>
> <feature name="Camera">
>     <param name="android-package" 
> value="org.apache.cordova.camera.CameraLauncher" />
>   </feature>
> {code}
> In {{AndroidManifest.xml}} I do have 
> {code}
> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
> {code}  
> Here are some logs
> {code}
> E/DatabaseUtils(24425): java.lang.SecurityException: Permission Denial: 
> reading com.android.externalstorage.ExternalStorageProvider uri conten
> nts/document/primary%3ADownload/11june.pdf from pid=22853, uid=10197 requires 
> android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
> E/DatabaseUtils(24425):         at 
> android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:467)
> E/DatabaseUtils(24425):         at 
> android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:394)
> E/DatabaseUtils(24425):         at 
> android.content.ContentProvider$Transport.query(ContentProvider.java:194)
> E/DatabaseUtils(24425):         at 
> android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
> E/DatabaseUtils(24425):         at 
> android.os.Binder.execTransact(Binder.java:404)
> E/DatabaseUtils(24425):         at dalvik.system.NativeStart.run(Native 
> Method)
> W/System.err(22853): java.lang.SecurityException: Permission Denial: reading 
> com.android.externalstorage.ExternalStorageProvider uri content:/
> /document/primary%3ADownload/11june.pdf from pid=22853, uid=10197 requires 
> android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
> W/System.err(22853):    at android.os.Parcel.readException(Parcel.java:1465)
> W/System.err(22853):    at 
> android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
> W/System.err(22853):    at 
> android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
> W/System.err(22853):    at 
> android.content.ContentProviderProxy.query(ContentProviderNative.java:413)
> W/System.err(22853):    at 
> android.content.ContentResolver.query(ContentResolver.java:461)
> W/System.err(22853):    at 
> android.content.ContentResolver.query(ContentResolver.java:404)
> W/System.err(22853):    at 
> org.apache.cordova.file.ContentFilesystem.openCursorForURL(ContentFilesystem.java:258)
> W/System.err(22853):    at 
> org.apache.cordova.file.ContentFilesystem.getFileMetadataForLocalURL(ContentFilesystem.java:169)
> W/System.err(22853):    at 
> org.apache.cordova.file.FileUtils.getFileMetadata(FileUtils.java:811)
> W/System.err(22853):    at 
> org.apache.cordova.file.FileUtils.access$400(FileUtils.java:52)
> W/System.err(22853):    at 
> org.apache.cordova.file.FileUtils$14.run(FileUtils.java:383)
> W/System.err(22853):    at 
> org.apache.cordova.file.FileUtils$24.run(FileUtils.java:540)
> W/System.err(22853):    at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
> W/System.err(22853):    at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
> W/System.err(22853):    at java.lang.Thread.run(Thread.java:841)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to