[BUG] File as a folder when syncing
Steps to reproduce
- Add a txt file to the account
- In app, download the file and go back to the list of files (marked with green)
- In the web, modify the txt file and save it.
- In app, pull to refresh
- When the file is syncing (blue badge), click on it to open
Actual behaviour
I noticed two different behaviours (it's a bit random)
- File is handled like a folder showing
No files in here - File is marked as conflicted (might be related with https://github.com/owncloud/android/issues/4733 ¿?)
I caught a video with behaviour 1.
https://github.com/user-attachments/assets/7f238089-73a5-4992-a815-25aa1cd828a9
This is not an easy one to reproduce and it does not happen every time. That's bad.
For that reason, my suggestion to avoid such bad cases is "blocking" the file while the blue icon is there. It would apply only to files (a syncing folder can be browsed, but not the files that are being synced).
Reproduced with both oCIS and oC10, using the app version `v4.7.0'
Devices: Xiaomi Redmi Note 13 Samsung Galaxy Tab A8
Hey, @jesmrec thank you for reporting this. Please assign it to me, if needed. thx
you can work on it @dataCenter430.
As you are starting to contribute, please take a look to our CONTRIBUTING file to get some tips about how to contribute. Please pay attention to:
- branch naming
- commit naming
- git model (we use rebase instead of merge)
any question, please don't hesitate to reach us. We are more than welcome!
Triage: valid bug, but the "file opens as a folder" root cause can't be pinned to a deterministic client-code defect — it needs the offending PROPFIND response / DB state. Notes from current master (51aa1fe):
How the folder-vs-file decision is made
- Tap routing is purely
ocFile.isFolder, with no guard on sync state —MainFileListFragment.kt:1567(onItemClick):if (ocFile.isFolder) updateFolderToDisplay(...) else onFileClicked(...). isFolderis derived only from mimeType —OCFile.kt:mimeType.isOneOf(MIME_DIR, MIME_DIR_UNIX), whereMIME_DIR = "DIR"/MIME_DIR_UNIX = "httpd/unix-directory"(MimeTypeConstants.kt:24-25).
So behaviour (1) "handled like a folder / No files in here" happens iff the OCFile's mimeType is DIR/httpd/unix-directory at tap time.
Where mimeType comes from
- Remote→local is a straight passthrough:
OCRemoteFileDataSource.toModel()copiesmimeTypeunchanged. - PROPFIND parsing:
RemoteFile.mimeTypedefaults to"DIR"and is only overwritten when a non-nullgetcontenttypeis present (RemoteFile.kt,getRemoteFileFromDav→is GetContentType -> property.type?.let { remoteFile.mimeType = it }). A file whose PROPFIND response carries no/emptygetcontenttypewould keepmimeType = "DIR"→ classified as a folder.
I could not find any client path that deterministically rewrites an existing file's mimeType to a folder mime during refresh (copyLocalPropertiesFrom does not touch mimeType). So the misclassification depends on the specific PROPFIND response or a transient row state during the refresh window — consistent with the "random, hard to reproduce" symptom. Behaviour (2) is a normal local+remote conflict (SynchronizeFileUseCase sets etagInConflict), plausibly the same #4733.
To locate this, a network capture (PROPFIND multistatus for the file, both oC10 and oCIS) at the moment of the bad refresh would confirm whether getcontenttype is missing/empty in that response.
On the proposed mitigation — blocking tap while the blue badge is shown is sound and is a small, localized change: onItemClick already receives OCFileWithSyncInfo (isSynchronizing), so it can short-circuit taps on a non-folder that is currently synchronizing. That guards the symptom even if the underlying mimeType glitch isn't fixed.
🤖 Generated with Claude Code