]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
geofeeds: Catch any invalid URLs
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jul 2023 10:17:19 +0000 (10:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jul 2023 10:17:19 +0000 (10:17 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/location-importer.in

index 20527f60b8908f1c28ac49c74041fea5cfd473ad..04c0cf98463a4193fa80f590b6592a50a04657a2 100644 (file)
@@ -19,6 +19,7 @@
 
 import argparse
 import concurrent.futures
+import http.client
 import ipaddress
 import json
 import logging
@@ -1428,7 +1429,7 @@ class CLI(object):
                                                WHERE geofeed_id = %s", geofeed.id)
 
                        # Catch any other errors and connection timeouts
-                       except (urllib.request.URLError, TimeoutError) as e:
+                       except (http.client.InvalidURL, urllib.request.URLError, TimeoutError) as e:
                                log.debug("Could not fetch URL %s: %s" % (geofeed.url, e))
 
                                self.db.execute("UPDATE geofeeds SET status = %s, error = %s \