Fix 404 on shipping sub-entity edit pages - #833
Merged
Conversation
Splitting ShippingController into per-entity controllers replaced the
conventional admin route (which ends in {id?}) with an attribute route
that had no id segment, so every EditMethod/EditDeliveryDate/
EditWarehouse/EditPickupPoint link generated by the grids resolved to
no endpoint at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GrGY1NnCzdkn7wUxbyHzsX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
Every edit page under Shipping returns 404 in both the Admin and the Store panel:
/Admin/Shipping/EditMethod/{id}/Admin/Shipping/EditDeliveryDate/{id}/Admin/Shipping/EditWarehouse/{id}/Admin/Shipping/EditPickupPoint/{id}The list pages render fine; only the row links 404.
Cause. ARCH-001 Phase 23 (#824) split
ShippingControllerinto four per-entity controllers and moved them from conventional routing to attribute routing:The old
ShippingControllercarried no[Route], so it was matched by the conventional admin route insrc/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs:14:which ends in
{id?}. The new attribute template dropped that segment, so a URL with an id trailing the action matches no endpoint. The grids emit exactly that URL —Areas/Admin/Views/Shipping/Methods.cshtml:76:PickupPointwas affected identically and is fixed here too.Solution
Restore the optional id segment on all eight affected controllers (4 in
Grand.Web.Admin, 4 inGrand.Web.Store):The
*ControllerAttributeTestsadded in #824 asserted the broken template verbatim, so those assertions were updated to the corrected one.Breaking changes
None. This only widens route matching — every URL that matched before still matches, plus the id-bearing ones that regressed.
Testing
/Store/Shipping/...) as a store owner.dotnet test src/Tests/Grand.Web.Admin.Tests/Grand.Web.Admin.Tests.csproj --filter "FullyQualifiedName~ControllerAttributeTests"→ 129 passed.dotnet test src/Tests/Grand.Web.Store.Tests/Grand.Web.Store.Tests.csproj --filter "FullyQualifiedName~ControllerAttributeTests"→ 70 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01GrGY1NnCzdkn7wUxbyHzsX