-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Read Order from endpoint manifest in StaticAssetEndpointFactory #65975
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| #nullable enable | ||
| Microsoft.AspNetCore.StaticAssets.StaticAssetDescriptor.Order.get -> string? | ||
| Microsoft.AspNetCore.StaticAssets.StaticAssetDescriptor.Order.set -> void |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,8 @@ public Endpoint Create(StaticAssetDescriptor resource, List<Action<EndpointBuild | |||||
| // Static resources always take precedence over default routes to mimic the behavior of UseStaticFiles. | ||||||
| // We give a -100 order to ensure that they are selected under normal circumstances, but leave a small lee-way | ||||||
|
||||||
| // We give a -100 order to ensure that they are selected under normal circumstances, but leave a small lee-way | |
| // We give a -100 order to ensure that they are selected under normal circumstances, but leave a small leeway |
Copilot
AI
Mar 25, 2026
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.
When resource.Order is present but not a valid int, this silently falls back to -100, which can mask a bad/corrupt manifest and produce unexpected routing precedence. Consider treating invalid non-empty values as an error (e.g., throw with route/manifest context, or at least log) and only default to -100 when the value is null/empty.
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.
Since this is a public API and the property type is
string?, the XML docs should clarify the expected format/range (e.g., invariant-culture integer that must fit inint) and what happens when an invalid value is provided. Right now it's easy for consumers to set a non-numeric value without realizing it will be ignored/defaulted at endpoint creation time.