-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Static Web Assets] Fix relative path matching #45039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for your PR, @javiercn. |
17126a8
to
a72e5b9
Compare
35ce9a8
to
81abe42
Compare
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs
Outdated
Show resolved
Hide resolved
eca36e5
to
2447969
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes relative path matching for static web assets when they are provided with full paths during asset discovery. The fix ensures that full paths are properly converted to relative paths before processing, which is necessary for correct asset handling.
- Adds logic to detect when a candidate asset path is rooted and converts it to a relative path
- Includes comprehensive test coverage for the new functionality across different scenarios
- Handles both Windows and Linux path formats appropriately
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs | Adds path normalization logic to convert full paths to relative paths when discovering assets |
test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/DiscoverStaticWebAssetsTest.cs | Adds three new test methods to verify relative path computation for different scenarios |
When discovering assets we also need to account for the case where the asset was provided with a full path (rare but happens) and make the path relative against the project folder before we process it.
Fixes #49038