fix: use runtime filesystem for file:// requests#686
Open
fraidev wants to merge 2 commits intosupabase:mainfrom
Open
fix: use runtime filesystem for file:// requests#686fraidev wants to merge 2 commits intosupabase:mainfrom
fraidev wants to merge 2 commits intosupabase:mainfrom
Conversation
Fixes file:// fetch handling to use the runtime's configured deno_fs instead of accessing host files directly. Changes: - Override snapshotted fetch handler with FsFetchHandler at runtime - Update vendored fetch handler to read via deno_fs - Add required dependencies for fs-backed fetch Tests: - Replace regression with real local npm file fetch case - Cover file:// behavior matching actual failure mode
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.
Closes #640.
Problem
fetch() calls against file:// URLs (e.g. those resolved from npm: specifiers via import.meta.resolve) were reading from the host filesystem directly via tokio::fs,
bypassing the runtime's configured deno_fs. This caused them to fail in sandboxed environments where the runtime FS differs from the host FS.
The root cause: the startup snapshot bakes in a default FsFetchHandler backed by tokio::fs, and nothing was overriding it post-snapshot with an implementation that uses
OpState's FileSystemRc.
Solution
Mirrors the fix from denoland/deno#31814:
FileSystemRc.