From 5cbe6700144dec3d8fc80053b9fcf4a4bf2c314b Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 19 Oct 2026 22:50:34 +0800 Subject: [PATCH] fix(webdav): upload the sync manifest as application/octet-stream CSTCloud Data Capsule's WebDAV server answers PUT manifest.json with 500 "Uploaded object size does not match the upload session" whenever the body is multi-line JSON sent as application/json. The same pretty JSON is stored byte-for-byte when sent as application/octet-stream, and db.sql / skills.zip already upload fine with their own types. Send the manifest with application/octet-stream. The manifest bytes and hash stay the same and readers never look at Content-Type, so old and new versions keep reading each other's manifests. S3 sync is unchanged. Refs #8554 --- src-tauri/src/services/webdav_sync.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/services/webdav_sync.rs b/src-tauri/src/services/webdav_sync.rs index 7228c80d5..b7309b697 100644 --- a/src-tauri/src/services/webdav_sync.rs +++ b/src-tauri/src/services/webdav_sync.rs @@ -31,6 +31,12 @@ pub(crate) fn sync_mutex() -> &'static tokio::sync::Mutex<()> { pub(crate) mod archive; +/// Content type for the manifest PUT. Some WebDAV servers (e.g. CSTCloud +/// Data Capsule) reject multi-line bodies sent as `application/json` with a +/// size-mismatch 500, while accepting the same bytes as a generic binary. +/// The bytes are unchanged, so readers of any version are unaffected. +const MANIFEST_CONTENT_TYPE: &str = "application/octet-stream"; + struct RemoteSnapshot { layout: RemoteLayout, manifest: SyncManifest, @@ -73,7 +79,7 @@ pub async fn upload( &manifest_url, &auth, snapshot.manifest_bytes, - "application/json", + MANIFEST_CONTENT_TYPE, ) .await?;