Skip to content

Commit

Permalink
corrected issue 605
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardbruelhart committed Aug 20, 2024
1 parent d945fe2 commit 4d1d1f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d1d1f8

Please sign in to comment.