Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: pattern matching should look for most specific rule defined #158

Closed
lanorkin opened this issue Aug 22, 2019 · 1 comment · Fixed by #159
Closed

bug: pattern matching should look for most specific rule defined #158

lanorkin opened this issue Aug 22, 2019 · 1 comment · Fixed by #159

Comments

@lanorkin
Copy link
Contributor

Tested with latest available version - 11.2.3

Looks like when no exact match found, tool tries to find first available pattern in simple A-Z order, while instead it should be looking for most specific redirect defined.

Steps to reproduce - create two redirects:

/oldsegment1/ => /newsegment1/
/oldsegment1/oldsegment2/ => /newsegment1/newsegment2/

then try to navigate /oldsegment1/oldsegment2/?q=test

Expected: redirected to /newsegment1/newsegment2/?q=test
Actual: redirected to /newsegment1/oldsegment2/?q=test

@lanorkin
Copy link
Contributor Author

Actually, looking at source code, it is AZ order just occasionally:

using (var enumerator = _quickLookupTable.GetEnumerator())

As it uses enumeration through Dictionary<TKey, TValue>, in reality, it is random order, because order is not specified as per msdn https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2

For purposes of enumeration, each item in the dictionary is treated as a KeyValuePair<TKey,TValue> structure representing a value and its key. The order in which the items are returned is undefined.

lanorkin added a commit to lanorkin/404handler that referenced this issue Aug 22, 2019
marisks added a commit that referenced this issue Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant