Repository navigation
Description
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"
Activity
jesmrec commentedon Dec 9, 2025
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.
alexknop commentedon Dec 9, 2025
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:
jesmrec commentedon Dec 10, 2025
thanks, will review it. CC @joragua
joragua commentedon Dec 12, 2025
Hi @alexknop! I cannot reproduce the problem that you mentioned. These are the steps that I followed:
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! 🙌🏻
alexknop commentedon Dec 13, 2025
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:
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:
partiallogcat.txt
jesmrec commentedon Dec 16, 2025
requested access to the video.
jesmrec commentedon Dec 17, 2025
@alexknop thanks for all the info, i was able to reproduce the problem, will check it together with your suggested solution.
alexknop commentedon Dec 17, 2025
@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.
joragua commentedon Dec 23, 2025
@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:
alexknop commentedon Jan 7, 2026
@joragua no, I am not seeing this while not interacting with the folder.
DeepDiver1975 commentedon Jul 3, 2026
Confirmed bug. Located in the available-offline re-sync path.
Root cause —
SynchronizeFileUseCase.kt(master):changedLocally = fileToSynchronize.localModificationTimestamp > lastSyncDateForData\!\!localModificationTimestampis the on-disk file mtime, read live:File(storagePath).lastModified()(OCFile.ktL174-180).lastSyncDateForDatais a wall-clock snapshot taken withSystem.currentTimeMillis()inDownloadFileWorker.ktL208/L215, not derived from the file's on-disk mtime.These are two independent clocks. Nothing sets the downloaded file's mtime to match
lastSyncDateForData(nosetLastModifiedanywhere in the download path — temp file is written thenrenameToinmoveTemporalFileToFinalLocation(),DownloadFileWorker.ktL182-197, which leaves the OS-assigned mtime). So the on-disk mtime can land after the sampledlastSyncDateForData, makingchangedLocallyfire on a file that was only downloaded, never edited. This matches @alexknop's captured values (mtime 19:20:07.859 > lastSyncDateForData 19:20:00.492) and the resulting spuriousUploadFileInConflictUseCasereupload.Notes:
\!isImageband-aid @alexknop tested masks it for images but leaves videos and any other file exposed; @alexknop already flagged it as a band-aid.lastSyncDateForDatasnapshot.Suggested direction (not a prescription): make the "changed locally" check compare against the file's own recorded state rather than a separate wall clock — e.g. store the on-disk mtime at save time and compare mtime-vs-mtime, or set the downloaded file's mtime deterministically so
localModificationTimestampandlastSyncDateForDatashare a basis.🤖 Generated with Claude Code