Skip to content

Fingerprint for resource-collection.js isn't correctly computed if only resource content change between runs #64028

@maraf

Description

@maraf

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Fingerprint for resource-collection isn't correctly computed when WasmFingerprintAssets=false for published application

counter:1  Failed to find a valid digest in the 'integrity' attribute for resource 'http://localhost:5000/_framework/resource-collection._wK-0.js' with computed SHA-256 integrity '8AX6Bh1INkeyvSAIk8gUqxjb+QPL2TfoxeyIrM1JZD0='. The resource has been blocked.

Expected Behavior

No response

Steps To Reproduce

  1. dotnet new blazor -int WebAssembly -o BlazorWebWasm
  2. dotnet publish -p:WasmFingerprintAssets=false
  3. cd BlazorWebWasm\BlazorWebWasm\bin\Release\net10.0\publish\
  4. dotnet exec .\BlazorWebWasm.dll
  5. Open the app in browser to store the file in cache
  6. Change Counter.razor in client project
  7. Publish and run the app again
  8. Open in browser

The request will be served from the cache, but the import map integrity will have a different value.
The fingerprint for resource-collection.js is computed only from file names contained inside, but not for hashes (integrity) of those files.

var url = resource.Url;
AppendToHash(incrementalHash, buffer, ref rented, url);

The problem occurs if user changes just user files (eg. styles) in wwwroot between two publishes

Exceptions (if any)

None

.NET Version

10.0.100-rc.2.25501.103

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Components

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions