Skip to content
Snippets Groups Projects
Verified Commit bdb08e30 authored by André's avatar André
Browse files

fix: Fix handling of URLs without scheme

Fixes #11059
parent c80134c4
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
from datetime import datetime from datetime import datetime
from datetime import timedelta from datetime import timedelta
from urllib.parse import unquote from urllib.parse import unquote
from urllib.parse import urlparse
from encodings.punycode import punycode_encode from encodings.punycode import punycode_encode
from functools import wraps from functools import wraps
from pathlib import Path from pathlib import Path
...@@ -990,6 +991,13 @@ def parse_uri(uri: str) -> URI: ...@@ -990,6 +991,13 @@ def parse_uri(uri: str) -> URI:
if uri.startswith('file://'): if uri.startswith('file://'):
return URI(type=URIType.FILE, data=uri) return URI(type=URIType.FILE, data=uri)
try:
urlparts = urlparse(uri)
if not urlparts.scheme:
return URI(type=URIType.WEB, data=f'http://{uri}')
except Exception:
pass
return URI(type=URIType.WEB, data=uri) return URI(type=URIType.WEB, data=uri)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment