-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Blazor] Emit action attribute when not explicit. #51130
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] Emit action attribute when not explicit. #51130
Conversation
31214c2
to
18387c2
Compare
18387c2
to
6ba91b0
Compare
src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs
Show resolved
Hide resolved
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 you've confirmed you'll deal with the duplicate history entries thing, I'm happy to approve now and leave it with you to address the final bits.
6ba91b0
to
5759f3e
Compare
Hi @javiercn. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
Hi @javiercn. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed. |
* Add unit tests * Fix end to end tests
31362f1
to
eee3f01
Compare
This change updates the server rendering logic to always emit an absolute URL for a form action when none is specified explicitly.
Description
When as part of rendering a form, the developer does not explicitly add an
action
attribute, the framework will automatically generate one with the value of the current request URL.Fixes #51118
Customer Impact
When enhanced navigation is active, the URL might change while an update to the page is in progress. In such situations, if the user clicks a button and submits a form, the form might incorrectly post to the wrong URL, as the page URL might have already been updated.
Given that when the URL updates on the document is not a behavior, we have control over, we have to account for this, and to prevent it, we make sure that we always generate forms with an action attribute, which is unambiguous.
Regression?
[If yes, specify the version the behavior has regressed from]
Risk
The fix is to detect forms without an
action
attribute and emit it to the current URL. This is correct in all cases and is unambiguous.Verification
Packaging changes reviewed?
When servicing release/2.1