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
+13 -3
View File
@@ -124,8 +124,13 @@ impl MiniCloudApi {
.await
.map_err(|e| format!("Sync-Tree Fehler: {}", e))?;
if !resp.status().is_success() {
let status = resp.status();
let text = resp.text().await.unwrap_or_default();
return Err(format!("Sync-Tree HTTP {}: {}", status, text));
}
let data: SyncTreeResponse = resp.json().await
.map_err(|e| format!("Parse-Fehler: {}", e))?;
.map_err(|e| format!("Sync-Tree Parse-Fehler: {}", e))?;
Ok(data.tree)
}
@@ -204,9 +209,14 @@ impl MiniCloudApi {
.json(&body)
.send()
.await
.map_err(|e| e.to_string())?;
.map_err(|e| format!("Create-Folder Verbindungsfehler: {}", e))?;
resp.json().await.map_err(|e| e.to_string())
if !resp.status().is_success() {
let status = resp.status();
let text = resp.text().await.unwrap_or_default();
return Err(format!("Create-Folder fehlgeschlagen ({}): {}", status, text));
}
resp.json().await.map_err(|e| format!("Create-Folder Parse-Fehler: {}", e))
}
pub async fn lock_file(&self, file_id: i64, client_info: &str) -> Result<(), String> {