You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Unsynchronized files already downloaded via Android document provider #3404
When I select a file in my OwnCloud folder via the standard Android file dialog in an Android app (not the OwnCloud app), often the selected file is not synchronized/up-to-date.
I can fix the problem by opening the OwnCloud app and downloading the desired file. After that, I get the synchronized file by using the standard Android file dialog in other Android apps.
Steps to reproduce
Download a file within the ownCloud Android App
Modify the file within other clients
Open an editor and open the file using the DocumentsProvider
Downloaded version is opened (but not the latest one)
After saving it, a new conflict notification appears
Hi @axoze, thanks for reporting this. You are totally right.
When using the documents provider we only download the version from the server if the file is not downloaded yet. In case it is already downloaded, we do not check if the version is outdated. That's why you got this error.
It could be fixed by adding a new call to check if we have the latest version. It could increase the time to open the file but we will assure that we are working with the most updated version.
Do I have to wait for a fix in the OwnCloud app or is it possible to adopt a third-party Android app suitably? (For example: Can I tell the documents provider to not use any "cached" versions of a file?)
No, it is not possible at all. This is related to the ownCloud App. This happens when you previously downloaded the file.
As a temporary solution, you can sync the file within the ownCloudApp and then open it via documents provider. Or you can remove the file locally, and then open it, so the latest version will be downloaded.
Well that's really a strange behavior of the OwnCloud app: the file dialog shows the correct date and time of the most up-to-date version of the file, but I get an older version of the file. To me, that's not what I'm expecting if I want to synchronize files ...
Please add at least an option "always download files when opening" to the OwnCloud app.
🤖 Automated issue triage by Claude Code review agent.
Confirmed — this bug is still present in the current code. In DocumentsStorageProvider.openDocument(), the read path only triggers a download when the file is not already available locally:
if (\!ocFile.isAvailableLocally) {
downloadFileUseCase(...) // only downloads if no local copy...
}
val fileToOpen =File(ocFile.storagePath)
returnif (\!isWrite) {
ParcelFileDescriptor.open(fileToOpen, accessMode) // opens local copy, no freshness check
}
When a local copy already exists, the file is opened directly with no check of whether the server has a newer version (no ETag comparison, no SynchronizeFileUseCase call). SynchronizeFileUseCase is only invoked on the write/close path, not on open-for-read. This matches the root cause @abelgardep described in 2021.
A fix would synchronize (or at least compare ETags) before opening an already-downloaded file for reading, downloading the newer version if the server copy is more recent — at the cost of some added latency on open, as noted in the thread.
No fix PR currently exists for this. Recording as a confirmed bug for maintainer prioritization.
Activity
michaelstingl commentedon Oct 4, 2021
Please access files with Document Provider Integration:
https://doc.owncloud.com/android/latest/document_provider.html
Direct access to device filesystem is deprecated and won't be possible with the next version.
axoze commentedon Oct 4, 2021
Sorry for having been unclear, but the app uses Document Provider integration:
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("*/*");(if needed, I can post more code)
michaelstingl commentedon Oct 4, 2021
Could you post the exact steps you performed? Maybe add some screenshots too…
abelgardep commentedon Oct 5, 2021
Hi @axoze, thanks for reporting this. You are totally right.
When using the documents provider we only download the version from the server if the file is not downloaded yet. In case it is already downloaded, we do not check if the version is outdated. That's why you got this error.
It could be fixed by adding a new call to check if we have the latest version. It could increase the time to open the file but we will assure that we are working with the most updated version.
axoze commentedon Oct 5, 2021
Do I have to wait for a fix in the OwnCloud app or is it possible to adopt a third-party Android app suitably? (For example: Can I tell the documents provider to not use any "cached" versions of a file?)
abelgardep commentedon Oct 5, 2021
No, it is not possible at all. This is related to the ownCloud App. This happens when you previously downloaded the file.
As a temporary solution, you can sync the file within the ownCloudApp and then open it via documents provider. Or you can remove the file locally, and then open it, so the latest version will be downloaded.
axoze commentedon Oct 5, 2021
Well that's really a strange behavior of the OwnCloud app: the file dialog shows the correct date and time of the most up-to-date version of the file, but I get an older version of the file. To me, that's not what I'm expecting if I want to synchronize files ...
Please add at least an option "always download files when opening" to the OwnCloud app.
Thank you!
christian-dienste commentedon Feb 24, 2022
THANKS, it works that way
I also use files from marc apps & software (no permissions) to have one click access to own cloud files
christian
michaelstingl commentedon Apr 13, 2023
Check ETAG before opening? What's the effort?
5 remaining items
jesmrec commentedon Aug 21, 2023
@axoze no fix for the moment, but it's in our minds (together with many others). Thanks for the patience.
DeepDiver1975 commentedon Jun 29, 2026
🤖 Automated issue triage by Claude Code review agent.
Confirmed — this bug is still present in the current code. In
DocumentsStorageProvider.openDocument(), the read path only triggers a download when the file is not already available locally:When a local copy already exists, the file is opened directly with no check of whether the server has a newer version (no ETag comparison, no
SynchronizeFileUseCasecall).SynchronizeFileUseCaseis only invoked on the write/close path, not on open-for-read. This matches the root cause @abelgardep described in 2021.A fix would synchronize (or at least compare ETags) before opening an already-downloaded file for reading, downloading the newer version if the server copy is more recent — at the cost of some added latency on open, as noted in the thread.
No fix PR currently exists for this. Recording as a confirmed bug for maintainer prioritization.
🤖 Generated with Claude Code