Repository navigation
fix(annotate): resolve shared HTML assets within selected folders - #1568
Open
leoreisdias wants to merge 1 commit into
Open
leoreisdias wants to merge 1 commit into
leoreisdias wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Problem
Folder annotation loses shared styles and scripts when an HTML page references assets outside its own directory, even when those assets are inside the selected folder. For example, annotating
course/leaveslessons/lesson.htmlunstyled when it links to../assets/lesson.css.Fix
Use the selected folder as the permitted asset root, while resolving relative references from each HTML document's directory. The same folder context is used by the Bun and Pi servers and by portable HTML sharing. This lets nested pages reuse a common
assets/directory without moving files or inlining their CSS and JavaScript.Single-file annotation retains its existing directory scope. Asset reads still enforce realpath containment, including rejection of symlinks pointing outside the permitted root.
Review focus
The main boundary is
htmlAssetContext: root and document paths are canonicalized together so selecting a folder through a symlink works. URL decoding applies only to authored references, preserving literal%characters in filesystem directory names. The shared rewriter carries the document-relative base through HTML attributes, inline CSS, andsrcset.Verification
PATH.