Fix DataUriSource description to include "data:" prefix#91455
Merged
Fix DataUriSource description to include "data:" prefix#91455
Conversation
The description now shows the full data URI prefix (e.g. "data:image/svg+xml;charset=utf8,...") instead of just the raw data content, making it clearer in error messages what the source represents. Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Tests Passed |
Merging this PR will not alter performance
Comparing Footnotes
|
lukesandberg
approved these changes
Mar 16, 2026
Contributor
lukesandberg
left a comment
There was a problem hiding this comment.
@lukesandberg approved this PR from Slack with Graphite
Member
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.
What?
Fix the
description()method ofDataUriSourcein Turbopack to include the fulldata:URI prefix in the display string.Before:
data URI content (svg+xml;charset=utf8,...)After:
data URI content (data:svg+xml;charset=utf8,...)Why?
The previous implementation only included the raw data content starting from the media type, omitting the
data:scheme prefix. This made the description string look malformed and not recognizable as a data URI — especially in error messages where this description is shown to developers.The fix reconstructs the proper data URI format (
data:<media_type>[;<encoding>],<data>) before truncating it to 50 characters, so the displayed prefix is a valid (partial) data URI that developers can recognize and understand.How?
In
turbopack/crates/turbopack-core/src/data_uri_source.rs, thedescription()function now builds the full data URI string first (data:{media_type}{sep}{encoding},{data}), then takes the first 50 characters of that. This ensures thedata:scheme prefix is always present in the truncated display.Closes NEXT-