Repository navigation
fix(path): sanitize cache path host and improve cross-platform path handling - #722
Open
reginaldalfret wants to merge 2 commits into
Open
reginaldalfret wants to merge 2 commits into
reginaldalfret wants to merge 2 commits into
Conversation
…andling - Sanitize host colons in schemastore.cachePathForURL to prevent invalid directory/filename syntax on Windows - Support rooted POSIX-style paths in justfile resolveImportPath on Windows platforms - Use platform-independent filepath comparisons and robust tempfile cacheDir in schemastore and justfile tests - Correct absolute schema URL prefix expectation in cli_test.go Signed-off-by: Reginald Alfret <reginaldalfret@gmail.com>
Collaborator
|
@reginaldalfret Thank you for the PR! I'll take a look ASAP. |
kehoecj
requested changes
Nov 2, 2026
kehoecj
left a comment
Collaborator
There was a problem hiding this comment.
@reginaldalfret Please add a CHANGELOG entry. Thanks!
Signed-off-by: Reginald Alfret <reginaldalfret@gmail.com>
Author
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.
Description
This pull request addresses cross-platform path handling issues affecting schema cache storage and path resolution on Windows systems.
Summary of Changes
pkg/schemastore/schemastore.go, sanitized colons (:) inparsed.HostwithincachePathForURLto prevent Windows filesystem errors when caching schemas from URLs containing port numbers (e.g.,http://127.0.0.1:8080/schema.json). On Windows,:is an invalid filename/directory character.pkg/validator/justfile/gojust.go, enhancedresolveImportPathto recognize leading forward and backward slashes as rooted paths on Windows (wherefilepath.IsAbsreturns false for volume-less rooted paths such as/path/to/import.just), preventing incorrect prepending of the parent directory./separators inschemastore_test.goandresolve_test.gowithfilepath.Jointo match platform-specific paths.TestFetchAndCacheUnwritableDirto use a regular file path ascacheDir, ensuring a cross-platform failure on directory creation without relying on Unix-specific root permissions.Test_toSchemaURLinpkg/cli/cli_test.goto match the expected file URL prefix generated for absolute paths on Windows and Unix alike.Verification
go test -v ./pkg/schemastore/...passes.go test -v ./pkg/validator/justfile/...passes.go test -v -run Test_toSchemaURL ./pkg/cli/...passes.go vet ./...reports 0 issues.