Skip to content

[BUG] Crash when mimetype is empty #2984

@theScrabi

Description

@theScrabi

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:

  1. Use mitm proxy and intercept response
  2. Pull down to refresh inside files view
  3. 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.

fix: #2986

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions