Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #60 from gfyans/master
Browse files Browse the repository at this point in the history
Force URLs to lowercase when searching
  • Loading branch information
kipusoep committed Feb 9, 2015
2 parents c52a09a + 1ec7595 commit 63b8764
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Modules/UrlTrackerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static void LoadUrlTrackerMatchesFromCache(HttpRequest request, string urlWithou
if (forcedRedirects == null || !forcedRedirects.Any())
return;

foreach (UrlTrackerModel forcedRedirect in forcedRedirects.Where(x => !x.Is404 && x.RedirectRootNodeId == rootNodeId && (x.OldUrl == urlWithoutQueryString || x.OldUrl == shortestUrl)).OrderBy(x => x.RedirectHttpCode == 410 ? 2 : 1).ThenByDescending(x => x.OldUrlQueryString))
foreach (UrlTrackerModel forcedRedirect in forcedRedirects.Where(x => !x.Is404 && x.RedirectRootNodeId == rootNodeId && (x.OldUrl.ToLower() == urlWithoutQueryString.ToLower() || x.OldUrl.ToLower() == shortestUrl.ToLower())).OrderBy(x => x.RedirectHttpCode == 410 ? 2 : 1).ThenByDescending(x => x.OldUrlQueryString))
{
LoggingHelper.LogInformation("UrlTracker HttpModule | URL match found");
if (forcedRedirect.RedirectNodeId.HasValue && forcedRedirect.RedirectHttpCode != (int)HttpStatusCode.Gone)
Expand Down
4 changes: 2 additions & 2 deletions Repositories/UrlTrackerRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ public static UrlTrackerModel GetUrlTrackerEntryById(int id)
[Obsolete("Remove not found entries also with root id, use other method")]
public static UrlTrackerModel GetNotFoundEntryByUrl(string url)
{
return GetNotFoundEntries().Single(x => x.OldUrl == url);
return GetNotFoundEntries().Single(x => x.OldUrl.ToLower() == url.ToLower());
}

public static UrlTrackerModel GetNotFoundEntryByRootAndUrl(int redirectRootNodeId, string url)
{
return GetNotFoundEntries().Single(x => x.OldUrl == url && x.RedirectRootNodeId == redirectRootNodeId);
return GetNotFoundEntries().Single(x => x.OldUrl.ToLower() == url.ToLower() && x.RedirectRootNodeId == redirectRootNodeId);
}

public static List<UrlTrackerModel> GetUrlTrackerEntries(int? maximumRows, int? startRowIndex, string sortExpression = "", bool _404 = false, bool include410Gone = false, bool showAutoEntries = true, bool showCustomEntries = true, bool showRegexEntries = true, string keyword = "", bool onlyForcedRedirects = false)
Expand Down

0 comments on commit 63b8764

Please sign in to comment.