From 4d1d1f8b5496121a8031f4b589416ba6deaea79f Mon Sep 17 00:00:00 2001 From: edouardbruelhart Date: Tue, 20 Aug 2024 09:34:10 +0200 Subject: [PATCH] corrected issue 605 --- qfieldsync/core/cloud_api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qfieldsync/core/cloud_api.py b/qfieldsync/core/cloud_api.py index 05040fc6..911c5923 100644 --- a/qfieldsync/core/cloud_api.py +++ b/qfieldsync/core/cloud_api.py @@ -226,9 +226,14 @@ def set_url(self, server_url: str) -> None: if not server_url: server_url = CloudNetworkAccessManager.server_urls()[0] - # Ignore the URL path, as we assume the url is always /api/v1. Assume the URL has a scheme or at least starts with leading //. + # Ignore the URL path in certain conditions. Assume the URL has a scheme or at least starts with leading //. p = urlparse(server_url) - self.url = f"{p.scheme or 'https'}://{p.netloc}/" + + if p.path.startswith("/api") or p.path == "/": + self.url = f"{p.scheme or 'https'}://{p.netloc}/" + else: + self.url = f"{p.scheme or 'https'}://{p.netloc}{p.path}" + self.preferences.set_value("qfieldCloudServerUrl", server_url) @property