[BUG] Copying/moving files to ownCloud through document provider does not work if app folders are not created
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.2k
- Forks
- 3.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 7
Description
Actual behaviour
- Files are not copied/moved to ownCloud.
Expected behaviour
- Files are properly copied/moved to ownCloud.
Steps to reproduce
- Remove all the folders related to ownCloud from your internal storage.
- Install ownCloud app.
- Open Files/Downloads app.
- Select a bunch of files from internal storage or Images section.
- Tap three dots button and select copy or move to an ownCloud account.
Environment data
Android version: 8.1.0
Device model: Nexus 5X
Stock or customized system: Stock
ownCloud app version: 2.12
Android logs
2019-09-18 13:40:01.584 24792-24855/com.owncloud.android.debug E/DatabaseUtils: Writing exception to parcel
android.os.ParcelableException: java.io.FileNotFoundException: File -1 not found
at android.provider.DocumentsProvider.call(DocumentsProvider.java:951)
at android.content.ContentProvider$Transport.call(ContentProvider.java:401)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:272)
at android.os.Binder.execTransact(Binder.java:697)
Caused by: java.io.FileNotFoundException: File -1 not found
at com.owncloud.android.providers.DocumentsStorageProvider.getFileByIdOrException(DocumentsStorageProvider.kt:516)
at com.owncloud.android.providers.DocumentsStorageProvider.deleteDocument(DocumentsStorageProvider.kt:332)
at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1046)
at android.provider.DocumentsProvider.call(DocumentsProvider.java:949)
at android.content.ContentProvider$Transport.call(ContentProvider.java:401)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:272)
at android.os.Binder.execTransact(Binder.java:697)
The cause of this problem is that the document providers needs to have a temporal folder in external storage to copy/move files and that folder is not currently created till we download something from the ownCloud app.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure after removing ownCloud folders from internal storage, then inspect DocumentsStorageProvider.kt around getFileByIdOrException at line 516 and deleteDocument at line 332. Trace how the temporary external-storage folder is handled during document-provider copy or move; done means both operations succeed before any download has occurred.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100