Repository navigation
Preserve special characters in browser file paths - #24
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
There was a problem hiding this comment.
The PR replaces encodeURI with a custom encodePath that splits the path on /, applies encodeURIComponent to each segment, and rejoins. This correctly encodes #, ?, and other reserved characters in filenames while preserving directory separators. The change covers whole-file reads, range reads, and (via the shared request method) metadata requests. A new regression test exercises #, ?, literal % sequences, Unicode, and backslashes.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve
Browser file reads treat
#and?in filenames as URL delimiters, so paths such as/app/a#b.txtrequest the wrong resource. Encode each path segment for whole-file, metadata and range requests while preserving directory separators.The regression test covers metadata, whole-file reads and range reads for filenames containing
#,?, literal percent sequences, Unicode and backslashes.Validation: the new test failed before the fix and passes after it; TypeScript typecheck passed.