From 4b047dba6453ebb964e7300e6f3f1403608d5ff0 Mon Sep 17 00:00:00 2001 From: Travis Wellman Date: Tue, 3 Jul 2012 13:13:50 -0700 Subject: [PATCH] count path segments by looking at the path * TooManyPathSegmentsDecideRule evaluate(CrawlURI) previously counted slashes in the full URI. Now it only counts slashes in the path of the URI, meaning a URI with slashes in the query string will not be counted as having more path segments than it has in its path. --- .../modules/deciderules/TooManyPathSegmentsDecideRule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/src/main/java/org/archive/modules/deciderules/TooManyPathSegmentsDecideRule.java b/modules/src/main/java/org/archive/modules/deciderules/TooManyPathSegmentsDecideRule.java index 85268b2d..4ec9e7bb 100644 --- a/modules/src/main/java/org/archive/modules/deciderules/TooManyPathSegmentsDecideRule.java +++ b/modules/src/main/java/org/archive/modules/deciderules/TooManyPathSegmentsDecideRule.java @@ -63,11 +63,11 @@ public class TooManyPathSegmentsDecideRule extends PredicatedDecideRule { */ @Override protected boolean evaluate(CrawlURI curi) { - String uri = curi.toString(); + String uriPath = curi.getUURI().getEscapedPath(); int count = 0; int threshold = getMaxPathDepth(); - for (int i = 0; i < uri.length(); i++) { - if (uri.charAt(i) == '/') { + for (int i = 0; i < uriPath.length(); i++) { + if (uriPath.charAt(i) == '/') { count++; } if (count > threshold) {