Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Robots/Robots.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public bool Allowed(Uri uri, string userAgent)
return true;


string[] uriParts = uri.LocalPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
string[] uriParts = uri.LocalPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var disallowEntry in userAgentEntry.DisallowEntries)
{
bool result;
Expand Down Expand Up @@ -337,7 +337,11 @@ private bool CheckExplicitlyAllowed(UserAgentEntry userAgentEntry, Uri uri)
private static bool CheckAllowedEntry(AllowEntry entry, string[] uriParts, out bool allow)
{
allow = true;
string[] robotInstructionUriParts = entry.Url.PathAndQuery.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
// Ignoring querystring for now!! Remove the following 3 lines when querystring, in particular the '*?*' token, is handled correctly.
if (entry.Url.PathAndQuery.Contains("?") == true) {
return allow;
}
string[] robotInstructionUriParts = entry.Url.PathAndQuery.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);

if (robotInstructionUriParts.Length > uriParts.Length)
return false;
Expand All @@ -362,7 +366,11 @@ private static bool CheckAllowedEntry(AllowEntry entry, string[] uriParts, out b
private static bool CheckDisallowedEntry(DisallowEntry entry, string[] uriParts, out bool allow)
{
allow = true;
string[] robotInstructionUriParts = entry.Url.PathAndQuery.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
// Ignoring querystring for now!! Remove the following 3 lines when querystring, in particular the '*?*' token, is handled correctly.
if (entry.Url.PathAndQuery.Contains("?") == true) {
return allow;
}
string[] robotInstructionUriParts = entry.Url.PathAndQuery.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);

if (robotInstructionUriParts.Length > uriParts.Length)
return false;
Expand Down