Skip to content

fix: upload pasted base64 images via source.uploadMedia - #1227

Merged
tripodsan merged 1 commit into
mainfrom
b64media
Aug 10, 2026
Merged

tripodsan merged 1 commit into
mainfrom
b64media

Conversation

@tripodsan

Copy link
Copy Markdown
Contributor

Summary

  • fix: upload dropped images via source.uploadMedia #1219 switched dropped-image uploads from source.save to source.uploadMedia, since uploadMedia content-addresses the file (the real, possibly relative ./media_..., URL is only known from the upload response). base64uploader.js (pasted/Word-paste base64 images) still used source.save and assumed the upload path itself was the final URL — that assumption breaks once the same content-addressing applies here too.
  • Switched base64uploader.js to source.uploadMedia, and now resolves each image's final src from the upload response's contentUrl instead of a pre-computed path.
  • Simplified the upload flow to per-image: extracted uploadBase64Image(view, { src, path, fpoSrc }), called (fire-and-forget, as before) per pasted image, and dispatched as soon as that image's own upload resolves — rather than batching all pasted images behind a single Promise.all. This also makes the upload path directly testable/awaitable.
  • Added minimal failure handling (log + leave the FPO placeholder in place) since the previous code silently proceeded to swap in a possibly-broken URL on failure.

Test plan

  • Added test/unit/blocks/edit/prose/plugins/base64uploader.test.js: placeholder synchronicity, uploadMedia (not save) is called, the FPO placeholder is swapped for the response contentUrl (including a relative ./media_... path), failed uploads log and leave the placeholder, and an end-to-end transformPastedHTML → upload → swap flow.
  • Full unit suite passes (npm test): 1800 passed, 0 failed, 4 skipped.
  • Manual check in a browser: paste an image (e.g. from Word/clipboard) into the prose editor and confirm it uploads and renders correctly.

🤖 Generated with Claude Code

Mirrors #1219's switch for dropped images: source.save assumed the
upload path itself was the final addressable URL, but uploadMedia
content-addresses the file, so the real URL (now possibly a relative
./media_... path) is only known from the response. Swap each pasted
image's FPO placeholder for that response URL as soon as its own
upload resolves, instead of waiting for every pasted image to finish.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Aug 10, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@tripodsan
tripodsan requested a review from kptdobe August 10, 2026 13:18
@tripodsan
tripodsan merged commit bf44b1a into main Aug 10, 2026
4 of 5 checks passed
@tripodsan
tripodsan deleted the b64media branch August 10, 2026 20:31
tripodsan added a commit that referenced this pull request Aug 11, 2026
…1228)

* fix: serialize Playwright CI runs against shared external test sites

Both playwright.yml and playwright-hlx.yml run tests against fixed,
shared external sites (da-sites/da-status and
da-testautomation/da-e2e-tests respectively) with no isolation between
concurrent runs. Overlapping CI jobs from different PRs collide on the
same backend, causing document create/cleanup races and timeouts that
look like hangs (e.g. run 31389050902 on #1227: 27 failures, all
timing out waiting for the editor to load, while two other PRs' Helix
jobs were running against the same site concurrently).

Add a concurrency group per workflow so runs queue instead of racing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(e2e): catch late-appearing alert banners in dismissAlertBanner

dismissAlertBanner only checked once, with a bounded 3s wait, near the
start of each test. Some banners (e.g. the "public sandbox" org
warning on da-sites/da-status) depend on an async check that can
resolve later than that window, so the one-shot check missed them —
the banner then appeared mid-test and sat on top of later controls,
blocking clicks (e.g. "Clicking Preview opens a confirmation dialog"
timing out after 30s trying to click button.preview-button, blocked by
#nx-toast-host's "Notifications" region).

Now, if the banner isn't visible in the initial window, arm a
background watcher for the rest of the test so a late appearance still
gets dismissed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

3 participants