Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Check these when upgrading, as they change how existing rules and integrations b

### Fixed

- The Redirects tab keeps its sort order after deleting or editing a redirect, as it already did with the search and the page. Before, the list went back to the default order.
- Editing a regex redirect keeps its place in the order. Before, the edit form didn't send the order number, which moved the rule to the top, where it was tried first.
- The admin pages confirm that a redirect was saved, deleted or ignored. Before, the page just reloaded.
- Redirects that keep leading to more redirects now end in a 404 after `MaxRedirectHops` redirects in a row (default 10), with a warning in the log, and stay that way for up to 30 seconds. Before, two rules pointing into each other (`/a` -> `/b/c` and `/b` -> `/a/d`) or a regex rule matching its own result (`^/(.*)$` -> `/en/$1`) went on until the browser gave up. Each server counts on its own, so behind a load balancer without session affinity, the browser's limit can still be reached first. Browsers follow remembered permanent redirects without asking the server, so permanent redirects sending a url back and forth still end in the browser's error, and permanent redirects that grow do so after a few visits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@
class="mt-3 btn btn-primary"
asp-route-pagenumber="@Model.Items.PageNumber"
asp-route-query="@Model.Query"
asp-route-sortcolumn="@Model.SortColumn"
asp-route-sortdirection="@Model.SortDirection"
asp-page-handler="update">Update
</button>
</form>
Expand Down Expand Up @@ -211,7 +213,9 @@
asp-page-handler="delete"
asp-route-id="@item.Id"
asp-route-pagenumber="@Model.Items.PageNumber"
asp-route-query="@Model.Query">
asp-route-query="@Model.Query"
asp-route-sortcolumn="@Model.SortColumn"
asp-route-sortdirection="@Model.SortDirection">
<span data-feather="trash-2"></span> delete
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ public IndexModel(IRedirectsService redirectsService)

public bool HasQuery => !string.IsNullOrEmpty(Query);

public void OnGet(RedirectsRequest request, string sortColumn, SortDirection? sortDirection)
public void OnGet(RedirectsRequest request)
{
ApplyRequest(request);
ApplySort(sortColumn, sortDirection);

Load();
}
Expand Down Expand Up @@ -114,6 +113,8 @@ public IActionResult OnPostUpdate(RedirectsRequest request)
return RedirectToPage(request);
}

ApplyRequest(request);

Load();
return Page();
}
Expand Down Expand Up @@ -141,5 +142,7 @@ private void ApplyRequest(RedirectsRequest request)
}

Query = request.Query ?? Query;

ApplySort(request.SortColumn, request.SortDirection);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Geta.NotFoundHandler.Admin.Areas.GetaNotFoundHandlerAdmin.Pages.Models;

namespace Geta.NotFoundHandler.Admin.Areas.GetaNotFoundHandlerAdmin.Pages;

Expand All @@ -7,4 +8,6 @@ public class RedirectsRequest
public string Query { get; set; }
public int? PageNumber { get; set; }
public Guid? Id { get; set; }
public string SortColumn { get; set; }
public SortDirection? SortDirection { get; set; }
}
Loading