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
This commit is contained in:
Jason committed 2026-10-20 21:50:16 +08:00
1 parent 2dfc848f4d
commit 5cbe670014
1 file changed
+7 -1
+7 -1
View File
@@ -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?;