diff --git a/linkcheck/listeners.py b/linkcheck/listeners.py index 0642aeb..170b51a 100644 --- a/linkcheck/listeners.py +++ b/linkcheck/listeners.py @@ -96,7 +96,10 @@ def do_check_instance_links(sender, instance, wait=False): if len(url) > MAX_URL_LENGTH: # We cannot handle url longer than MAX_URL_LENGTH at the moment - logger.warning('URL exceeding max length will be skipped: %s', url) + if url.startswith("data:"): + # If the URL is a data URL, it might occupy a LOT of space in the logs without being useful – truncate it + url = url[:64] + logger.warning('URL exceeding max length will be skipped: %s (in %r)', url, instance) continue u, created = Url.objects.get_or_create(url=url) diff --git a/linkcheck/utils.py b/linkcheck/utils.py index b40dbb5..c189fec 100644 --- a/linkcheck/utils.py +++ b/linkcheck/utils.py @@ -134,7 +134,10 @@ def update_urls(urls, content_type, object_id): if len(url) > MAX_URL_LENGTH: # We cannot handle url longer than MAX_URL_LENGTH at the moment - logger.warning("URL exceeding max length will be skipped: %s", url) + if url.startswith("data:"): + # If the URL is a data URL, it might occupy a LOT of space in the logs without being useful – truncate it + url = url[:64] + logger.warning("URL exceeding max length will be skipped: %s (in %r)", url, instance) continue url, url_created = Url.objects.get_or_create(url=url)