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

Wayback Error Fix #764

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion bbot/core/helpers/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def collapse_urls(urls, threshold=10):
"""
url_hashes = {}
for url in urls:
new_url = clean_url(url)
try:
new_url = clean_url(url)
except ValueError as e:
log.verbose(f"Failed to clean url {url}: {e}")
url_hash = hash_url(new_url)
try:
url_hashes[url_hash].add(new_url)
Expand Down
2 changes: 2 additions & 0 deletions bbot/test/test_step_1/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ async def test_helpers_misc(helpers, scan, bbot_scanner, bbot_config, bbot_https
assert helpers.validators.clean_url("http://evilcorp.com/asdf?a=asdf#frag").geturl() == "http://evilcorp.com/asdf"
assert helpers.validators.clean_url("http://evilcorp.com//asdf").geturl() == "http://evilcorp.com/asdf"
assert helpers.validators.clean_url("http://evilcorp.com.").geturl() == "http://evilcorp.com/"
with pytest.raises(ValueError):
helpers.validators.clean_url("http://evilcorp,com")

assert helpers.url_depth("http://evilcorp.com/asdf/user/") == 2
assert helpers.url_depth("http://evilcorp.com/asdf/user") == 2
Expand Down