fix: Sync-Fehler "error decoding response body" + Server-Edits

Drei Probleme in einem:

1. create_folder/get_sync_tree parsten die Response auch bei HTTP-
   Fehlern als JSON. Bei 401/409/etc. kam "error decoding response
   body" statt der eigentlichen Fehlermeldung. Status wird jetzt
   zuerst geprueft, Body-Text wird bei Fehlern zurueckgegeben.

2. Ohne Journal-Eintrag und unterschiedlichen Hashes wurde vorher
   eine Konflikt-Kopie erstellt. Fuer Server-Edits aus dem Web-UI
   (wo der Client die Datei gar nie mit Journal erfasst hatte) war
   das falsch. Nextcloud-Ansatz: beim Erstkontakt Server
   autoritativ - Download statt Konflikt-Kopie.

3. run_sync_now uebernimmt neu konfigurierte sync_paths aus dem
   State, damit manuelle Syncs auch nach add_sync_path greifen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-12 10:25:01 +02:00
parent 28fb1c47c2
commit 5f905b4925
3 changed files with 22 additions and 4 deletions
+7 -1
View File
@@ -274,7 +274,13 @@ impl SyncEngine {
let (local_changed, server_changed) = match &journal_entry {
Some(j) => (local_hash != j.synced_checksum, server_hash != j.synced_checksum),
None => (true, true), // unknown history - treat as conflict to be safe
None => {
// No journal history: this is the first time we're tracking
// this file. Treat the server as authoritative (Nextcloud
// does the same on first sync) so edits made on the web
// GUI or other clients propagate down cleanly.
(false, true)
}
};
if local_changed && !server_changed {