From 7e7bfa4fff53726f0ec487409443cb39cddf04d9 Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Tue, 9 Sep 2025 11:29:53 +0100 Subject: [PATCH 1/2] Fix #311 : Exception when dealing with malformed SLD --- .gitignore | 3 +++ src/qgis_geonode/utils.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5342ab8..2b1367a 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,6 @@ dmypy.json # Development .idea/ .vscode/ +# Generated files +src/qgis_geonode/metadata.txt +src/qgis_geonode/resources.py diff --git a/src/qgis_geonode/utils.py b/src/qgis_geonode/utils.py index 77f94b1..0c38b34 100644 --- a/src/qgis_geonode/utils.py +++ b/src/qgis_geonode/utils.py @@ -54,7 +54,11 @@ def remove_comments_from_sld(element): def url_from_geoserver(base_url: str, raw_url: str): # Clean the URL path from trailing and back slashes - url_path = urlparse(raw_url).path.strip("/") + try: + url_path = urlparse(raw_url).path.strip("/") + except TypeError: + QgsMessageLog.logMessage("Incorrect type returned from GeoServer", "GeoNode", Qgis.Warning ) + return None url_path = url_path.split("/") # re-join URL path without the geoserver path From 6f99b44a440eabd5fa4473f0d4d346c93f603bad Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Tue, 9 Sep 2025 14:15:19 +0100 Subject: [PATCH 2/2] Fix #311 : Address formatting issues --- src/qgis_geonode/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qgis_geonode/utils.py b/src/qgis_geonode/utils.py index 0c38b34..cc37197 100644 --- a/src/qgis_geonode/utils.py +++ b/src/qgis_geonode/utils.py @@ -57,7 +57,10 @@ def url_from_geoserver(base_url: str, raw_url: str): try: url_path = urlparse(raw_url).path.strip("/") except TypeError: - QgsMessageLog.logMessage("Incorrect type returned from GeoServer", "GeoNode", Qgis.Warning ) + QgsMessageLog.logMessage( + "Incorrect type returned from GeoServer", + "GeoNode", + Qgis.Warning) return None url_path = url_path.split("/")