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
+2
View File
@@ -244,6 +244,8 @@ async fn run_sync_now(state: State<'_, AppState>) -> Result<Vec<String>, String>
if let Some(ref api) = *state.api.lock().unwrap() {
engine.api.access_token = api.access_token.clone();
}
// Refresh sync_paths from state: user may have added/removed paths
engine.sync_paths = state.sync_paths.lock().unwrap().clone();
let result = engine.sync_all().await;
*state.sync_engine.lock().unwrap() = Some(engine);
result