Skip to content

[BUG] Unsynchronized files already downloaded via Android document provider #3404

Open

Description

@axoze

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

  1. Download a file within the ownCloud Android App
  2. Modify the file within other clients
  3. Open an editor and open the file using the DocumentsProvider
  4. Downloaded version is opened (but not the latest one)
  5. After saving it, a new conflict notification appears

Activity

  1. michaelstingl commented on Oct 4, 2021

    @michaelstingl
    Contributor

    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.

  2. axoze commented on Oct 4, 2021

    @axoze
    Author

    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)

  3. michaelstingl commented on Oct 4, 2021

    @michaelstingl
    Contributor

    Could you post the exact steps you performed? Maybe add some screenshots too…

  4. abelgardep commented on Oct 5, 2021

    @abelgardep
    Contributor

    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.

  5. axoze commented on Oct 5, 2021

    @axoze
    Author

    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?)

  6. abelgardep commented on Oct 5, 2021

    @abelgardep
    Contributor

    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.

  7. axoze commented on Oct 5, 2021

    @axoze
    Author

    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!

  8. added this to the 2.20-next milestone on Nov 19, 2021
  9. modified the milestones: 2.20-current, -next on Feb 3, 2022
  10. christian-dienste commented on Feb 24, 2022

    @christian-dienste

    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.

    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

  11. michaelstingl commented on Apr 13, 2023

    @michaelstingl
    Contributor

    Check ETAG before opening? What's the effort?

  12. 5 remaining items

  13. jesmrec commented on Aug 21, 2023

    @jesmrec
    Member

    @axoze no fix for the moment, but it's in our minds (together with many others). Thanks for the patience.

  14. modified the milestones: 4.5 - Current, Backlog on Feb 7, 2025
  15. modified the milestones: Backlog, 4.7 - Next on Jun 6, 2025
  16. modified the milestones: 4.7 - Current, Backlog on Oct 31, 2025
  17. DeepDiver1975 commented on Jun 29, 2026

    @DeepDiver1975
    Contributor

    🤖 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)
    return if (\!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.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions