fix(operations): classify file refs by scheme to support absolute paths#2739
Open
AruneshDwivedi wants to merge 1 commit into
Open
fix(operations): classify file refs by scheme to support absolute paths#2739AruneshDwivedi wants to merge 1 commit into
AruneshDwivedi wants to merge 1 commit into
Conversation
url.ParseRequestURI treats absolute local paths (e.g. /tmp/cm.yaml) as valid URIs, routing them through go-getter (LoadFromURI) instead of reading from disk (Load). This caused apply/assert with absolute file: paths to fail with 'found no test in <path>'. Fix: check for a non-empty scheme to distinguish real URLs from local paths. Also handle absolute paths explicitly (no basePath prefix) before falling back to relative paths. Fixes kyverno#2735 Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
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.
fileRefOrResourceandfileRefOrCheckuseurl.ParseRequestURI(ref)to distinguish URLs from local file paths. ButParseRequestURItreats absolute local paths like/home/user/file.yamlas valid URIs (they have no scheme but ParseRequestURI accepts them).The fix checks for a non-empty scheme instead. If the parsed URI has no scheme, it's a local file path. This lets chainsaw load test files from absolute paths without treating them as URLs.
Fixes #2739