[BUG] Crash when mimetype is empty
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.2k
- Forks
- 3.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 7
Description
When the server returns an empty mimetype on a PROPFIND, the app will crash because it tries to figure out weather the current resource element is a direcotry or not by comparing the returned mimetype against the string DIR. However since the returned mimetype is null the app crashes:
java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference
at com.owncloud.android.utils.FileStorageUtils.createOCFileFromRemoteFile(FileStorageUtils.java:108)
at com.owncloud.android.operations.SynchronizeFolderOperation.mergeRemoteFolder(SynchronizeFolderOperation.java:337)
at com.owncloud.android.operations.SynchronizeFolderOperation.run(SynchronizeFolderOperation.java:225)
at com.owncloud.android.lib.common.operations.RemoteOperation.runOperation(RemoteOperation.java:240)
at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:205)
at com.owncloud.android.operations.common.SyncOperation.execute(SyncOperation.java:87)
at com.owncloud.android.operations.RefreshFolderOperation.run(RefreshFolderOperation.java:143)
at com.owncloud.android.lib.common.operations.RemoteOperation.runOperation(RemoteOperation.java:240)
at com.owncloud.android.lib.common.operations.RemoteOperation.run(RemoteOperation.java:259)
This does normally not happen as the server should always send a mimetype, however if he does not we aparently must be prepared.
Steps to reproduce:
- Use mitm proxy and intercept response
- Pull down to refresh inside files view
- When response of propfind is send remove content inside the
<contenttype></contenttype>tag
This may sometimes happen when a user creates a file without file ending, or if a file without file ending is shared.
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
Start at FileStorageUtils.createOCFileFromRemoteFile in FileStorageUtils.java around line 108, then trace the call from SynchronizeFolderOperation.mergeRemoteFolder. Reproduce the empty case with the mitm proxy steps and review PR 2986; done means a PROPFIND with an empty mimetype no longer crashes during refresh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100