Carlos Casalicchio
12/19/2024, 6:13 PM/quotes/by-toby-mensforth
or quotes/by-debby-ryan
or quotes/by-gaby-hoffmann
it just doesn't reach the controller at all.
There are over 90K authors, and most work fine.
Any suggestions on how to debug this?
https://cdn.discordapp.com/attachments/1319367100636332103/1319370048833323019/quote-2.png?ex=6765b69c&is=6764651c&hm=b22ccf31925b573532e1a64ce299b0f31d3563d711f40154f64a0f01eb8ac4e6&
https://cdn.discordapp.com/attachments/1319367100636332103/1319370049185648710/quote-1.png?ex=6765b69c&is=6764651c&hm=eb8562cf9710b3488a5cbc659e700b53a7cc8e90ecaad8e8e15b9fecce7c65b7&kdx-perbol
12/19/2024, 7:45 PM/home/sv-SE/my-page
) by either ASP or Umbraco, I forget which. Then a "culture specified in URL" mechanism took precedence over our routing. I wonder if something similar could be happening here.kdx-perbol
12/19/2024, 7:46 PMby
and is 4 or 5 characters). Do you have any examples that are very different?Carlos Casalicchio
12/19/2024, 7:48 PMkdx-perbol
12/19/2024, 7:49 PMCarlos Casalicchio
12/19/2024, 7:50 PMkdx-perbol
12/19/2024, 7:50 PMCarlos Casalicchio
12/19/2024, 7:51 PMCarlos Casalicchio
01/30/2025, 7:00 PMcsharp
public class AuthorConflictContentFinder(IUmbracoContextAccessor umbracoContextAccessor) : IContentFinder
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor = umbracoContextAccessor;
public async Task<bool> TryFindContent(IPublishedRequestBuilder request)
{
var path = request.Uri.GetAbsolutePathDecoded();
string pattern = @"^/quotes/by-([a-z]+(-[a-z]+)*)(\?page=(\d+))?(&topic=([^&]+))?$";
Regex regex = new(pattern, RegexOptions.IgnoreCase);
var match = regex.Match(path);
if (match.Success)
{
var authorSlug = match.Groups[1].Value;
var page = match.Groups[3].Length > 0 ? int.Parse(match.Groups[3].Value) : 1;
var topic = match.Groups[4].Length > 0 ? match.Groups[4].Value : "";
var pagination = new Pagination();
if (pagination.Page == 0) pagination.Page = page;
if (pagination.PageSize == 0) pagination.PageSize = 14;
if (_umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
{
var contentPage = umbracoContext.Content!.GetAtRoot().DescendantsOrSelf<Quotes>().FirstOrDefault();
contentPage!.AuthorSlug = authorSlug;
contentPage!.Pagination = pagination;
contentPage!.Topic = topic;
await Task.FromResult(0);
request.SetPublishedContent(contentPage);
}
return true;
}
return false;
}
}