Skip to content

Conversation

javiercn
Copy link
Member

@javiercn javiercn commented Nov 22, 2024

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

@ghost ghost added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member labels Nov 22, 2024
Copy link
Contributor

Thanks for your PR, @javiercn.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

@javiercn javiercn force-pushed the javiercn/fix-relative-path-matching branch from 17126a8 to a72e5b9 Compare August 10, 2025 10:09
@javiercn javiercn linked an issue Aug 10, 2025 that may be closed by this pull request
@javiercn javiercn force-pushed the javiercn/fix-relative-path-matching branch 2 times, most recently from 35ce9a8 to 81abe42 Compare August 10, 2025 16:07
@javiercn javiercn force-pushed the javiercn/fix-relative-path-matching branch from eca36e5 to 2447969 Compare August 10, 2025 20:56
@javiercn javiercn marked this pull request as ready for review August 10, 2025 20:57
@Copilot Copilot AI review requested due to automatic review settings August 10, 2025 20:57
Copy link
Contributor

@Copilot Copilot AI left a 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

@javiercn javiercn merged commit 4431825 into main Aug 11, 2025
27 checks passed
@javiercn javiercn deleted the javiercn/fix-relative-path-matching branch August 11, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error: BLAZOR106 when building on Linux
3 participants