[stable35] fix(image): keep data: URI images on markdown round-trip - #9290
Merged
Merged
Conversation
Markdown files can legitimately contain base64 images. Both image parse rules excluded img[src^=data:] because the TipTap allowBase64 option defaults to false, so those images never made it into the document and were silently dropped from the file on the next save (#9108). Enable allowBase64 on the Image and ImageInline extensions: the file content is the user's own, and the editor is expected to preserve it, not to filter it. Regression test covers both the block (figure) and the inline image path. Signed-off-by: Guillaume Flambard <g.flambard@gmail.com>
allowBase64 flips the parse selector to accept any data: URI, with no mime filtering. The CSP already refuses to load a data: script, object or frame, and the src only ever reaches an <img>, so a non image payload cannot execute. This narrows the parse rules anyway, so a malformed mime type never becomes a node in the first place rather than relying on those two properties. The syntax then stays literal text, which keeps the user's characters intact and preserves the intent of #9108: nothing is dropped on save, it is simply not promoted to an image whose src could never render. Assisted-by: claude-code:claude-opus-5 Signed-off-by: Guillaume Flambard <g.flambard@gmail.com>
backportbot
Bot
requested review from
max-nextcloud,
mejo- and
silverkszlo
as code owners
September 28, 2026 13:18
mejo-
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #9159