Different file content between NC and the file on disk

Nextcloud version - 26.0.0
Operating system and version - Debian 11
Apache or nginx version : Apache 2.4.56
PHP version : php8.0

We have an application that creates and changes files in the NextCloud folders. After each change, the app executes the “occ:files scan” command to inform Nextcloud. It works nice for new files, or files that are only changed from the application.
If a text file is changed in the NC GUI (editor) and a short time later from the application, it shows a different content in NC and on disk. The “occ:files scan” does not fix the issue. The only way to fix it is to change the file date on disk (with a touch) and run the scan again. This forces NC to detect the difference and ask in the editor what version should be used.

Is there an occ command to force NC loading the file from disk after a change ?

I must admit that I’m not entirely sure if this command will fix the issue at hand, as it is primarily intended to scan the app data folder for changes.
However, I would suggest using the files:scan-app-data command additionally of files:scan where the files are being changed both through the Nextcloud GUI and the application.

Here’s the link to the doc:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#scan-appdata

That is the same behaviour, as if you made changes with another editor like Plain text editor (files_texteditor ).

My advice, follow this issue: https://github.com/nextcloud/text/issues/4078

that is something that is not recommended to change manually stuff in the Nextcloud data folder. You can change stuff in external storages (external for NC, it can be a local folder).

For processing uploaded files, do you use the workflow feature?

This way NC should take into account that a file was changed and keep the filecache-table up-to-date.

1 Like

thanks, but the files:scan-app-data does not change the situation

@ernolf - you are right, it seems to be Issue #4078

1 Like