fix(core): encode spaces in data: URI image targets - #1864
Merged
ggrossetie merged 1 commit intoJul 25, 2026
Conversation
AbstractNode#imageUri() short-circuited on any data: URI target by returning it unchanged, added to avoid a spurious "could not retrieve image data from URI" warning when embedding inline SVGs. That bypassed the space-encoding that normalizeWebPath() still applies to every other URI-ish target, and that upstream Asciidoctor (Ruby) also applies since image_uri has no data:-specific early return. Run data: targets through encodeSpacesInUri() before returning them so output matches Ruby again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
AbstractNode#imageUri()no longer percent-encodes spaces in adata:URI image target (e.g.image::data:image/svg+xml,<svg ...><text>a b</text></svg>[]). This is a regression from the data URI image target support added for inline SVG embedding, which short-circuitedimageUri()for anydata:target by returning it unchanged — bypassing the space-encoding thatnormalizeWebPath()still applies to every other URI-ish target.Upstream Asciidoctor (Ruby) has no
data:-specific early return inimage_uriat all, so it always encodes spaces viaHelpers.encode_spaces_in_uri.imageUri()now runsdata:targets throughencodeSpacesInUri()before returning them, matching Ruby's output byte-for-byte, while still avoiding the spuriouscould not retrieve image data from URIwarning the earlier fix was meant to prevent.