Trusted Domains: strip HTTP basic auth credentials also when adding as trusted domain via context menu

This commit is contained in:
Tremolo4 2021-07-24 04:26:28 +02:00
parent 17d15ff7f5
commit 0b1cc52fbd

View File

@ -395,12 +395,15 @@ def playlistIsValid(files):
def getDomainFromURL(URL):
try:
URL = URL.split("//")[-1].split("/")[0]
if URL.startswith("www."):
URL = URL[4:]
return URL
except:
o = urllib.parse.urlparse(URL)
except ValueError:
# not a URL
return None
if o.hostname is not None and o.hostname.startswith("www."):
return o.hostname[4:]
else:
# may return None if URL does not have domain (invalid url)
return o.hostname
def open_system_file_browser(path):