Skip to content

Commit

Permalink
Merge pull request #607 from edouardbruelhart/master
Browse files Browse the repository at this point in the history
correction poposition for issue 605
  • Loading branch information
suricactus authored Nov 18, 2024
2 parents 4ce2bb3 + dadeab5 commit c70e6b5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,15 @@ 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 //.
# 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}/"

# QFieldSync will automatically append `/api/v1` to the path, so prevent double append like `/api/v1/api/v1`.
if p.path.startswith("/api/v1"):
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 c70e6b5

Please sign in to comment.