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