-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[Blazor] Update WebAssembly.DevServer
to serve the Blazor-Environment
header
#57971
base: main
Are you sure you want to change the base?
Conversation
/backport to release/9.0-rc2 |
Started backporting to release/9.0-rc2: https://github.com/dotnet/aspnetcore/actions/runs/10949630835 |
else if (applyCopHeaders && ctx.Request.Path.StartsWithSegments("/_framework") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.server.js") && !ctx.Request.Path.StartsWithSegments("/_framework/blazor.web.js")) | ||
{ | ||
var fileExtension = Path.GetExtension(ctx.Request.Path); | ||
if (string.Equals(fileExtension, ".js", StringComparison.Ordinal)) |
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.
Why didn't an analyzer catch this previously? Also, it's more consistent to ignore case.
if (string.Equals(fileExtension, ".js", StringComparison.Ordinal)) | |
if (string.Equals(fileExtension, ".js", StringComparison.OrdinalIgnoreCase)) |
I can't think of a reason a request would come in with an uppercase .JS
extension, but file extensions generally are case insensitive, and the dev server would still serve the correct file. StartsWithSegments
also defaults to OrdinalIgnoreCase
.
Since the dev server no longer calls
UseBlazorFrameworkFiles()
, we need to manually add theBlazor-Environment
header when applicable.Fixes #57941