Skip to content

Commit

Permalink
Merge branch 'master' into project-history-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinBuira committed Jan 10, 2025
2 parents 6bc441c + 2957994 commit 2216886
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Mergin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,13 @@ def send_logs(username, logfile):

def validate_mergin_url(url):
"""
Validation of mergin URL by pinging. Checks if URL points at compatible Mergin server.
Initiates connection to the provided server URL to check if the server is accessible
:param url: String Mergin Maps URL to ping.
:return: String error message as result of validation. If None, URL is valid.
"""
try:
mc = MerginClient(url, proxy_config=get_qgis_proxy_config(url))
if not mc.is_server_compatible():
return "Incompatible Mergin Maps server"
MerginClient(url, proxy_config=get_qgis_proxy_config(url))

# Valid but not Mergin URl
except ClientError:
return "Invalid Mergin Maps URL"
Expand Down Expand Up @@ -1223,7 +1222,7 @@ def test_server_connection(url, username, password):
result = True, "<font color=green> OK </font>"
proxy_config = get_qgis_proxy_config(url)
try:
mc = MerginClient(url, None, username, password, get_plugin_version(), proxy_config)
MerginClient(url, None, username, password, get_plugin_version(), proxy_config)
except (LoginError, ClientError) as e:
QgsApplication.messageLog().logMessage(f"Mergin Maps plugin: {str(e)}")
result = False, f"<font color=red> Connection failed, {str(e)} </font>"
Expand Down

0 comments on commit 2216886

Please sign in to comment.