From 01377f761a9534d23ee6f301ccdfff81c6919ab9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 30 Aug 2024 18:07:46 +0200 Subject: [PATCH] curl tests: Skip assets hosted on a third party site ... though display a warning about it --- lib/curl_tests.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/curl_tests.py b/lib/curl_tests.py index 168aece..c4caca4 100644 --- a/lib/curl_tests.py +++ b/lib/curl_tests.py @@ -210,8 +210,15 @@ def test( "\033[1m\033[93mWARN\033[0m auto_test_assets set to true, but no js/css asset found in this page" ) for asset in assets_to_check: - if asset.startswith(f"https://{domain}"): - asset = asset.replace(f"https://{domain}", "") + # FIXME : this is pretty clumsy, should probably be replaced with a proper URL parsing to serparate domains etc... + if asset.startswith(f"https://"): + if asset.startswith(f"https://{domain}"): + asset = asset.replace(f"https://{domain}", "") + elif: + print( + "\033[1m\033[93mWARN\033[0m Found asset '{asset}' which seems to be hosted on a third party, external website ... Not super great for privacy etc... ?" + ) + continue elif asset.startswith(f"{domain}/"): asset = asset.replace(f"{domain}/", "") if not asset.startswith("/"):