-
Notifications
You must be signed in to change notification settings - Fork 9
fix(runner): inline data URIs before handling write redirects #1911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move data URI inlining logic to occur before write redirect (alias) handling in normalizeAndDiff. This ensures the correct evaluation order when a data URI contains a redirect link. Previously, when newValue was a data URI containing a redirect, the code would: 1. Check currentValue for redirects (line 290) 2. Follow currentValue redirect if present 3. Process data URI inlining later (line 318) This caused the redirect within the data URI to be written to the wrong location - it would follow the currentValue redirect first, then inline the data URI, resulting in the redirect being written to the destination of the currentValue alias instead of to the intended target. The fix reorders the logic so data URIs are inlined immediately after unwrapping proxies and cells (line 212), before any redirect handling. This preserves the invariant that redirect handling at line 290 only applies when newValue is not itself an alias. The order is now: 1. Unwrap proxies/cells 2. Inline data URIs (exposing any contained redirects) 3. Handle redirects in newValue 4. Handle redirects in currentValue This ensures redirects contained in data URIs are properly recognized and handled as part of newValue, not incorrectly written through a currentValue redirect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the normalizeAndDiff function where data URIs containing redirect links were being written to incorrect locations. The fix reorders the processing logic to inline data URIs immediately after unwrapping proxies/cells and before handling any redirect (alias) logic.
Key changes:
- Moved data URI inlining logic from line 318 to line 212, executing it earlier in the evaluation sequence
- Relocated helper function
isImmediateParentanddiffLoggerconstant to improve code organization - Preserved all existing functionality while fixing the evaluation order bug
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
ellyxir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
fixes my broken pattern, thanks! |
Move data URI inlining logic to occur before write redirect (alias) handling in normalizeAndDiff. This ensures the correct evaluation order when a data URI contains a redirect link.
Previously, when newValue was a data URI containing a redirect, the code would:
This caused the redirect within the data URI to be written to the wrong location - it would follow the currentValue redirect first, then inline the data URI, resulting in the redirect being written to the destination of the currentValue alias instead of to the intended target.
The fix reorders the logic so data URIs are inlined immediately after unwrapping proxies and cells (line 212), before any redirect handling. This preserves the invariant that redirect handling at line 290 only applies when newValue is not itself an alias.
The order is now:
This ensures redirects contained in data URIs are properly recognized and handled as part of newValue, not incorrectly written through a currentValue redirect.
Summary by cubic
Fixes incorrect write redirects when newValue is a data: URI by inlining it before any redirect handling. Redirects inside data URIs now apply to the intended target, not through the currentValue alias.