Skip to content

Fix 404 on shipping sub-entity edit pages - #833

Merged
KrzysztofPajak merged 1 commit into
developfrom
fix/shipping-subentity-edit-routes
Sep 12, 2026
Merged

Fix 404 on shipping sub-entity edit pages#833
KrzysztofPajak merged 1 commit into
developfrom
fix/shipping-subentity-edit-routes

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

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 ShippingController into four per-entity controllers and moved them from conventional routing to attribute routing:

[Route("[area]/Shipping/[action]")]

The old ShippingController carried no [Route], so it was matched by the conventional admin route in src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs:14:

admin/{controller=Home}/{action=Index}/{id?}

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:

template: '<a class="k-link" href="EditMethod/#=Id#">#=Name#</a>',

PickupPoint was affected identically and is fixed here too.

Solution

Restore the optional id segment on all eight affected controllers (4 in Grand.Web.Admin, 4 in Grand.Web.Store):

[Route("[area]/Shipping/[action]/{id?}")]

The *ControllerAttributeTests added 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

  1. Run the Admin panel and log in as an administrator.
  2. Go to Configuration → Shipping → Shipping methods. Click any method name in the grid. The edit page loads (before this change: 404).
  3. Repeat for Delivery dates, Warehouses and Pickup points — each row link opens its edit page.
  4. Save a change on one of those edit pages and confirm it persists.
  5. Repeat steps 2–4 in the Store panel (/Store/Shipping/...) as a store owner.
  6. dotnet test src/Tests/Grand.Web.Admin.Tests/Grand.Web.Admin.Tests.csproj --filter "FullyQualifiedName~ControllerAttributeTests" → 129 passed.
  7. 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

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
Copilot AI lite review requested due to automatic review settings September 12, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KrzysztofPajak
KrzysztofPajak merged commit 1050640 into develop Sep 12, 2026
4 of 5 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/shipping-subentity-edit-routes branch September 12, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants