From 576a3d7540a68f9c75015623754d9c9d73a3f770 Mon Sep 17 00:00:00 2001 From: Anders Bjerner Date: Thu, 18 Jan 2024 00:29:39 +0100 Subject: [PATCH] #H5IS The first character should be stripped from the query string. I think this was the result of me testing in a slightly different context where the query string had a leading question mark, but then failed to realize that this wasn't the case here. (cherry picked from commit 783b5b9e921c66f49711f4b76f8235f8b935d59f) --- src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs b/src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs index e7c11db..32df02a 100644 --- a/src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs +++ b/src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs @@ -151,7 +151,7 @@ public void DeleteRedirect(IRedirect redirect) { // To support query string forwarding, we should only return a redirect that match either of the two criteria listed below: // - query string forwarding isn't enabled and the query string is an exact match // - query string forwarding is enabled and the query string is part of the query string of the inbound URI - string query1 = query.Length == 0 ? string.Empty : $"&{query[1..]}&"; + string query1 = query.Length == 0 ? string.Empty : $"&{query}&"; RedirectDto? dto = dtos.FirstOrDefault(x => (!x.ForwardQueryString && query == x.QueryString) || (query1.Contains($"&{x.QueryString}&") && x.ForwardQueryString)); // Wrap the DTO