Skip to content

Commit 5d9bb13

Browse files
committed
Additional adjustments to the query string forwarding logic
In earlier versions of this package the query string forwarding logic were primarily handled by querying the database, which was case insensitive. After moving some of the logic to C#, this part was somewhat unintentionally case sensitive, while the part still handled in the database was still case insensitive. With this commit both the database query and the C# logic are now case sensitive to better match the previous behavior. Whether it should in fact be case insensitive is however a whole other question. It probably shouldn't be, but it has been like this ever since the first release as SQL WHERE clauses are case insensitive. So we shouldn't change this behavior now. Related to #193 (cherry picked from commit 542a4a8)
1 parent ace3b1a commit 5d9bb13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Skybrud.Umbraco.Redirects/Services/RedirectsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void DeleteRedirect(IRedirect redirect) {
152152
// - query string forwarding isn't enabled and the query string is an exact match
153153
// - query string forwarding is enabled and the query string is part of the query string of the inbound URI
154154
string query1 = query.Length == 0 ? string.Empty : $"&{query}&";
155-
RedirectDto? dto = dtos.FirstOrDefault(x => (!x.ForwardQueryString && query == x.QueryString) || (x.QueryString.Length == 0 || query1.Contains($"&{x.QueryString}&") && x.ForwardQueryString));
155+
RedirectDto? dto = dtos.FirstOrDefault(x => (!x.ForwardQueryString && query.InvariantEquals(x.QueryString)) || (x.QueryString.Length == 0 || query1.InvariantContains($"&{x.QueryString}&") && x.ForwardQueryString));
156156

157157
// Wrap the DTO
158158
return dto == null ? null : new Redirect(dto);

0 commit comments

Comments
 (0)