mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-07-18 05:27:11 +00:00
Fix tests revealed to be failing
* UriUtils.java
isLikelyFalsePositive() - do not flag urls starting with ../ as likely false positives
* UriUtilsTest.java
remove test url that is now rejected
This commit is contained in:
@@ -273,8 +273,7 @@ public class UriUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TextUtils.matches("^\\.\\.?[^/].*", candidate)) {
|
||||
if (candidate.charAt(0) == '.' && !TextUtils.matches("^\\.{1,2}/.*", candidate)) {
|
||||
if (LOGGER.isLoggable(Level.FINE)) {
|
||||
LOGGER.fine("rejected: starts with '.' (but not './' or '../'): " + candidate);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,6 @@ public class UriUtilsTest extends TestCase {
|
||||
"cssp!gelui-1/overlay",
|
||||
"/wiki/%E0%B4%B8%E0%B4%B9%E0%B4%BE%E0%B4%AF%E0%B4%82:To_Read_in_Malayalam",
|
||||
"/wiki/Wikiversity:Why_create_an_account%3F",
|
||||
";s.channel=d.channel?d.channel:"
|
||||
};
|
||||
public void testRelatives() {
|
||||
tryAll(urisRelative, true);
|
||||
@@ -237,12 +236,7 @@ public class UriUtilsTest extends TestCase {
|
||||
*/
|
||||
protected void tryAll(String[] candidates, boolean expected) {
|
||||
for (String candidate : candidates) {
|
||||
assertEquals("new: " + candidate,
|
||||
expected,
|
||||
UriUtils.isLikelyUri(candidate));
|
||||
assertEquals("html context: " + candidate,
|
||||
expected,
|
||||
UriUtils.isLikelyUri(candidate));
|
||||
assertEquals(candidate, expected, UriUtils.isLikelyUri(candidate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user