[BUG] Offline Photos/Videos Not Syncing Correctly
Actual behaviour
-Observing issues trying to save a folder offline with various photos and videos in them -It seems local eTag of these photos, for example, can be just "" and the localModificationTimestamp is more recent. Even though the picture may just have been opened, but not actually modified. This triggers reuploads/redownloads when syncing.
Expected behaviour
-All photos/videos on the server should download successfully and not re-upload any old photos.
Steps to reproduce
- Place a collection of photos and videos on the server in one folder
- Set folder offline
- Observe synchronization/downloading conflicts
- Observe a fileToSynchronize where eTag is "" and localModificationTimestamp is recent, which triggers changedLocally and changedRemotely in SynchronizeFileUseCase.kt
Can this problem be reproduced with the official owncloud server? (url: https://ocis.ocis.master.owncloud.works, user: einstein, password: relativity)
Environment data
Android version: 16 Device model: Pixel 10 Stock or customized system: Stock ownCloud app version: 4.7.0 ownCloud server version: 10.18.0
Logs
Web server error log
Not seeing a lot of logs regarding this file from today:
192.168.1.5 - alex [15/Nov/2025:12:22:49 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251109_043929876.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
192.168.1.5 - alex [15/Nov/2025:12:23:08 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251109_043929876.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
192.168.1.5 - alex [15/Nov/2025:12:23:11 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251105_195209298.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
ownCloud log (data/owncloud.log)
192.168.1.5 - alex [15/Nov/2025:12:22:49 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251109_043929876.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
192.168.1.5 - alex [15/Nov/2025:12:23:08 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251109_043929876.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
192.168.1.5 - alex [15/Nov/2025:12:23:11 +0000] "PROPFIND /remote.php/dav/files/alex/Photos/Photos%20from%202025/PXL_20251105_195209298.mp4 HTTP/1.1" 207 1724 "-" "Mozilla/5.0 (Android) ownCloud-android/4.6.2"
Thanks for opening @alexknop, will check it. Just a couple of details. You mentioned 10.18.0, is that right? latest released version (vanilla) of oC10 is 10.16.0.
Conflicts arise when you set the folder as "available offline" in device (your step 2) and are marked with a white cross over red background, right? just to be sure we are on the same page.
Hello @jesmrec thanks for getting to this so quickly. I should clarify that I am running on server version 10.16. I'm going to test this on a folder containing less photos and videos. I have hundreds of them in this folder, and when I set a breakpoint to capture one instance where re-uploading would happen, I can't scroll on my phone to check if that file has the red X. However, I was noticing multiple photos and videos in my folder with the red X already. In the meantime, I am running this modified code and it appears to be working for me. No reuploads or red Xs:
// 3. Check if file has changed locally
val changedLocally = fileToSynchronize.localModificationTimestamp > fileToSynchronize.lastSyncDateForData!! && (!fileToSynchronize
.isImage)
Timber.i("Local file modification timestamp :${fileToSynchronize.localModificationTimestamp}" +
" and last sync date for data :${fileToSynchronize.lastSyncDateForData}")
Timber.i("So it has changed locally: $changedLocally")
// 4. Check if file has changed remotely
val changedRemotely = fileToSynchronize.etag != "" && (serverFile.etag != fileToSynchronize.etag)
Timber.i("Local etag :${fileToSynchronize.etag} and remote etag :${serverFile.etag}")
Timber.i("So it has changed remotely: $changedRemotely")
thanks, will review it. CC @joragua
Hi @alexknop! I cannot reproduce the problem that you mentioned. These are the steps that I followed:
- Create a folder and upload some files (images, PDFs...)
- Set the folder as available offline
- Open the folder and check the status of the files
All files show the pink check badge and not the white cross on a red background as you described. Could you check the steps above and let me know if I'm missing something? If possible, could you also attach a video showing the bug? Thanks! 🙌🏻
Ok @joragua so i was able to reproduce.
localModificationTimestamp: 2025-12-11 19:20:07.859 EST lastSyncDateForData: 2025-12-11 19:20:00.492 EST
Which is triggering changedLocally.
before downloading:
frankel:/data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos $ ls -lah Photos\ from\ 2023
Photos from 2023:
total 7
drwx------ 2 u0_a380 u0_a380 20K 2025-12-12 18:16 .
drwx------ 10 u0_a380 u0_a380 3.3K 2025-12-12 18:59 ..
frankel:/data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos $
12-12 19:19:58.476 9233 9734 D (ReadRemoteFileOperation.kt:75): I: Read remote file /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg with status 207
12-12 19:19:58.478 9233 9734 D (SynchronizeFileUseCase.kt:70): I: File 22-02-17 23-13-57 0656.jpg is not downloaded. Let's download it
12-12 19:19:58.509 9233 9734 D (DownloadFileUseCase.kt:103): I: Download of 22-02-17 23-13-57 0656.jpg has been enqueued.
12-12 19:20:00.492 9233 10676 D (DownloadRemoteFileOperation.kt:82): I: Download of /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg to /data/user/0/com.owncloud.android.debug/files/owncloud/tmp/[email protected]%3A8080/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg - HTTP status code: 207
12-12 19:20:01.045 9233 11092 D (ReadRemoteFileOperation.kt:75): I: Read remote file /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg with status 207
12-12 19:20:01.046 9233 11092 D (SynchronizeFileUseCase.kt:70): I: File 22-02-17 23-13-57 0656.jpg is not downloaded. Let's download it
12-12 19:20:01.871 9233 11092 D (DownloadFileUseCase.kt:103): I: Download of 22-02-17 23-13-57 0656.jpg has been enqueued.
12-12 19:20:07.866 9233 9283 D (DownloadRemoteFileOperation.kt:82): I: Download of /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg to /data/user/0/com.owncloud.android.debug/files/owncloud/tmp/[email protected]%3A8080/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg - HTTP status code: 207
12-12 19:20:17.918 9233 11139 D (ReadRemoteFileOperation.kt:75): I: Read remote file /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg with status 207
12-12 19:25:49.094 9233 11139 D (SynchronizeFileUseCase.kt:115): I: File 22-02-17 23-13-57 0656.jpg has changed locally. Let's upload the new version
12-12 19:25:49.097 9233 11139 D (UploadFileInConflictUseCase.kt:61): D: Upload file in conflict params: [email protected]:8080 | /data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg | /Photos/Photos from 2023/
12-12 19:25:49.110 9233 11139 D (UploadFileInConflictUseCase.kt:97): I: Upload of /Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg has been stored in the uploads database with id: 362
12-12 19:25:49.113 9233 11139 D (UploadFileInConflictUseCase.kt:130): I: Plain upload of /data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg has been enqueued.
12-12 19:25:49.203 9233 9293 D (UploadFileFromFileSystemWorker.kt:154): D: Upload info: OCTransfer(id=362, localPath=/data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg, remotePath=/Photos/Photos from 2023/22-02-17 23-13-57 0656.jpg, [email protected]:8080, fileSize=3190619, status=TRANSFER_QUEUED, localBehaviour=COPY, forceOverwrite=true, transferEndTimestamp=null, lastResult=null, createdBy=ENQUEUED_BY_USER, transferId=null, spaceId=null, sourcePath=null)
frankel:/data/user/0/com.owncloud.android.debug/files/owncloud/[email protected]%3A8080/Photos $ ls -lah Photos\ from\ 2023 | grep 0656
-rw------- 1 u0_a380 u0_a380 3.0M 2025-12-12 19:20 22-02-17 23-13-57 0656.jpg
From 19:20 to 19:25 I was sitting at my breakpoint and taking the timestamp values.
Here is the video.
https://drive.google.com/file/d/1S59aIWYYBumTz_6CS9xiwhAYNHWQHUuW/view?usp=drive_link
And all logcat entries from this time period:
requested access to the video.
@alexknop thanks for all the info, i was able to reproduce the problem, will check it together with your suggested solution.
@jesmrec Thank you, however my solution is just a bandaid. There's likely a better solution. Especially considering my logs are showing the file downloaded multiple times. I didn't really take the time to see what other functions are being called to cause this.
@alexknop, did you try waiting after setting the folder as available offline, without opening the folder or navigating through the app? 🤔 Just to confirm whether the issue might be related to the additional sync that runs separately from the available offline sync.
That means:
- Set the folder as available offline
- Don't interact with the device and wait until the folder is synchronized