owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.82k stars 3.05k forks source link

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

Open axoze opened 3 years ago

axoze commented 3 years ago

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
michaelstingl commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

abelgardep commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

michaelstingl commented 1 year ago

Check ETAG before opening? What's the effort?

axoze commented 1 year ago

May I ask what the status of my bug report is? Or is there a workaround?

jesmrec commented 1 year ago

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