clan-vm-manager: Fix regression part2

This commit is contained in:
Qubasa
2024-11-28 19:01:41 +01:00
parent 167f753bd3
commit cf2ddfc191
3 changed files with 24 additions and 10 deletions

View File

@@ -81,7 +81,7 @@ class ClanURI:
if machine_name:
uri += f"#{machine_name}"
# users might copy whitespace along with the uri
# Users might copy whitespace along with the URI
uri = uri.strip()
# Check if the URI starts with clan://
@@ -90,6 +90,12 @@ class ClanURI:
if uri.startswith(prefix):
uri = uri[len(prefix) :]
# Fix missing colon (caused by browsers like Firefox)
if "//" in uri and ":" not in uri.split("//", 1)[0]:
# If there's a `//` but no colon before it, add one before the `//`
parts = uri.split("//", 1)
uri = f"{parts[0]}://{parts[1]}"
# Parse the URI into components
# url://netloc/path;parameters?query#fragment
components: urllib.parse.ParseResult = urllib.parse.urlparse(uri)