Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android10: Crash when item is directory via FileProvider (i.e. Material Files) #28

Open
k3b opened this issue Mar 18, 2022 · 0 comments
Labels

Comments

@k3b
Copy link
Owner

k3b commented Mar 18, 2022

When "share" contains a directory in the android app Material Files ToGoZip crashes because it cannot resolve the directory.

togozip receives a share entry with mime type "vnd.android.document/directory" and the underlying FileProvider does not support getting files from directories (see comment in https://stackoverflow.com/questions/48062097/how-to-open-a-directoryfolder-in-android-using-file-provider )

2022-03-18 11:30:20.045 27876-27876/de.k3b.android.toGoZip D/k3b.zip: Extras[Stream] uri: adding file content://me.zhanghai.android.files.file_provider/file%253A%252F%252F%252Fstorage%252Femulated%252F0%252FDCIM%252Fsdtest%252Fsd_sub_test
2022-03-18 11:30:20.071 27876-27876/de.k3b.android.toGoZip D/k3b.zip: Data[file-content-uri=content://me.zhanghai.android.files.file_provider/file%253A%252F%252F%252Fstorage%252Femulated%252F0%252FDCIM%252Fsdtest%252Fsd_sub_test]: /storage/emulated/0/DCIM/sdtest/sd_sub_test
2022-03-18 11:30:20.079 27876-27876/de.k3b.android.toGoZip D/k3b.zip: (0) create new result file 2go.zip.tmp.zip
2022-03-18 11:30:21.064 27876-27876/de.k3b.android.toGoZip D/k3b.zip: (1b) copy new item [ ] DocumentFileCompressItem;sd_sub_test;/storage/emulated/0/DCIM/sdtest/sd_sub_test;content://me.zhanghai.android.files.file_provider/file%253A%252F%252F%252Fstorage%252Femulated%252F0%252FDCIM%252Fsdtest%252Fsd_sub_test as sd_sub_test to 2go.zip.tmp.zip
2022-03-18 11:30:21.114 27876-27876/de.k3b.android.toGoZip E/k3b-ziblib: Error in (1b) copy new item [ ] DocumentFileCompressItem;sd_sub_test;/storage/emulated/0/DCIM/sdtest/sd_sub_test;content://me.zhanghai.android.files.file_provider/file%253A%252F%252F%252Fstorage%252Femulated%252F0%252FDCIM%252Fsdtest%252Fsd_sub_test as sd_sub_test to 2go.zip.tmp.zip:read failed: EISDIR (Is a directory)
    java.io.IOException: read failed: EISDIR (Is a directory)
        at libcore.io.IoBridge.read(IoBridge.java:523)
        at java.io.FileInputStream.read(FileInputStream.java:313)
        at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:975)
        at java.io.FileInputStream.read(FileInputStream.java:282)
        at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:966)
        at de.k3b.io.FileUtils.copyStream(FileUtils.java:79)
        at de.k3b.zip.CompressJob.add(CompressJob.java:664)
        at de.k3b.zip.CompressJob.compress(CompressJob.java:482)
        at de.k3b.android.toGoZip.ToGoZipCompressJob.executeAddToZip(ToGoZipCompressJob.java:59)
        at de.k3b.android.toGoZip.Add2ZipActivity.executeZipJob(Add2ZipActivity.java:94)
        at de.k3b.android.toGoZip.Add2ZipActivity.onCreate(Add2ZipActivity.java:48)
        at android.app.Activity.performCreate(Activity.java:7835)
        at android.app.Activity.performCreate(Activity.java:7824)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3298)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3462)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7615)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
     Caused by: android.system.ErrnoException: read failed: EISDIR (Is a directory)
        at libcore.io.Linux.readBytes(Native Method)
        at libcore.io.Linux.read(Linux.java:190)
        at libcore.io.ForwardingOs.read(ForwardingOs.java:177)
        at libcore.io.BlockGuardOs.read(BlockGuardOs.java:303)
        at libcore.io.ForwardingOs.read(ForwardingOs.java:177)
        at libcore.io.IoBridge.read(IoBridge.java:513)
        at java.io.FileInputStream.read(FileInputStream.java:313) 
        at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:975) 
        at java.io.FileInputStream.read(FileInputStream.java:282) 
        at android.os.ParcelFileDescriptor$AutoCloseInputStream.read(ParcelFileDescriptor.java:966) 
        at de.k3b.io.FileUtils.copyStream(FileUtils.java:79) 
        at de.k3b.zip.CompressJob.add(CompressJob.java:664) 
        at de.k3b.zip.CompressJob.compress(CompressJob.java:482) 
        at de.k3b.android.toGoZip.ToGoZipCompressJob.executeAddToZip(ToGoZipCompressJob.java:59) 
        at de.k3b.android.toGoZip.Add2ZipActivity.executeZipJob(Add2ZipActivity.java:94) 
        at de.k3b.android.toGoZip.Add2ZipActivity.onCreate(Add2ZipActivity.java:48) 
        at android.app.Activity.performCreate(Activity.java:7835) 
        at android.app.Activity.performCreate(Activity.java:7824) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3298) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3462) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7615) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) 
2022-03-18 11:30:21.115 27876-27876/de.k3b.android.toGoZip D/k3b.zip: (5b) free resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant