Philipp Hörist pushed to branch master at gajim / gajim
Commits:
bdb08e30 by André Apitzsch at 2022-07-29T20:38:49+02:00
fix: Fix handling of URLs without scheme
Fixes #11059
- - - - -
1 changed file:
- gajim/common/helpers.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -57,6 +57,7 @@
from datetime import datetime
from datetime import timedelta
from urllib.parse import unquote
+from urllib.parse import urlparse
from encodings.punycode import punycode_encode
from functools import wraps
from pathlib import Path
@@ -990,6 +991,13 @@ def parse_uri(uri: str) -> URI:
if uri.startswith('file://'):
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)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/bdb08e307e61d2701423db4180691a28241e69bf
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/bdb08e307e61d2701423db4180691a28241e69bf
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits