From 785c8026f73c5c42e45aff428ff39a9c84ab5ff4 Mon Sep 17 00:00:00 2001 From: gpetrak Date: Wed, 13 Nov 2024 10:44:26 +0200 Subject: [PATCH] using Qurl instead of urllib --- src/qgis_geonode/gui/connection_dialog.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qgis_geonode/gui/connection_dialog.py b/src/qgis_geonode/gui/connection_dialog.py index 5e9db99..8b0a0af 100644 --- a/src/qgis_geonode/gui/connection_dialog.py +++ b/src/qgis_geonode/gui/connection_dialog.py @@ -2,8 +2,6 @@ import re import typing import uuid -from urllib.parse import urlparse - import qgis.core from qgis.gui import QgsMessageBar @@ -118,9 +116,11 @@ def __init__(self, connection_settings: typing.Optional[ConnectionSettings] = No def validate_geonode_url(self): - inserted_url = self.url_le.text().strip().rstrip("#/") - parsed_url = urlparse(inserted_url) - if parsed_url.path != "": + inserted_url = QtCore.QUrl(self.url_le.text().strip().rstrip("#/")) + + if inserted_url.isValid() == False: + return False + elif inserted_url.path() != "": return False else: return True @@ -188,7 +188,7 @@ def test_connection(self): qgis.core.QgsApplication.taskManager().addTask(self.discovery_task) else: self.enable_post_test_connection_buttons() - message = "Please insert only the domain part from the GeoNode URL" + message = "Please insert only the domain of a valid GeoNode URL" level = qgis.core.Qgis.Critical utils.show_message(self.bar, message, level)