Skip to content

fix(content): use multipart POST to upload files to DA#2744

Open
shsteimer wants to merge 2 commits into
mainfrom
fix/content-json-push-multipart-form-data
Open

fix(content): use multipart POST to upload files to DA#2744
shsteimer wants to merge 2 commits into
mainfrom
fix/content-json-push-multipart-form-data

Conversation

@shsteimer

@shsteimer shsteimer commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Related Issues

Fixes #2743.

DaClient.postSource (previously putSource) now sends files as multipart/form-data POST with the content as a Blob in the data field, matching the documented DA API contract. The previous raw-body PUT with Content-Type: application/json was silently ignored by the server for all non-HTML files.

The rename from putSourcepostSource is internal — DaClient is not exported from the package.

Note: potentially related to #2709, which adds JSON to the default clone set.


  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Thanks for contributing!

@shsteimer shsteimer changed the title fix(content): use multipart POST for all file uploads to DA fix(content): use multipart POST to upload files to DA Jun 13, 2026
The DA admin API only accepts raw body uploads for text/html. For all
other content types (including application/json), putHelper returns
undefined, causing putObject to write an empty {} to the props sidecar
instead of the file content. The server still returns 201 with a valid
JSON body, so helix-cli logged success and advanced the synced ref while
silently dropping the change.

Fix: replace the raw PUT with a multipart/form-data POST, wrapping the
buffer in a Blob in the `data` field. This is the documented DA API
contract for all file types. Rename putSource -> postSource to match.

Fixes: #2743

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shsteimer shsteimer force-pushed the fix/content-json-push-multipart-form-data branch from a5a23f0 to 9a954aa Compare June 13, 2026 17:58
@github-actions

Copy link
Copy Markdown

This PR will trigger a patch release when merged.

- Adds missing push-level test: synced ref must not advance when postSource
  throws (mirrors the existing deleteFails scenario)
- Corrects opts.onUpload JSDoc to document all three callback args

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shsteimer shsteimer marked this pull request as ready for review June 13, 2026 18:20

@tripodsan tripodsan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather change the server to finally allow non multipart puts....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(content): aem content push silently drops JSON file changes

2 participants