Bug: Sync during difficult network conditions might accidentally delete items from a library
When the app tries to run a sync in difficult network conditions (e.g. on a smartphone when not having a good network connection), it might happen under rare conditions that the app decides to delete some files/folders from the library on the server.
This must not happen. Some servers (e.g. NextCloud or ownCloud) will preserve the deleted files and allow to restore them via the Web interface. However, if a user uses another backend server, data must be lost completely - this must be prevented.
For this reason, the sync code must be reviewed and shall be cleaned up/restructured. Ideally, we use this to implement #198 (closed) and also switch to a different approach, i.e. properly embracing the event driven Qt APIs instead of doing one operation at a time and waiting for this to finish.
Ideally, the sync would run somehow like this:
- Phase: Find all changes (pull, push, delete) that need to be run.
- Phase: Pull files into a temporary location.
- Phase: Move files to final location and delete files on server.
- Phase: Update the sync DB with the most recent e-tags.
In addition, we should - where applicable - use WebDAV HTTP headers which ensure we push/delete only when the e-tag matches the one we know. This ensures the server-first sync strategy the app implements.