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): def getDomainFromURL(URL):
try: try:
URL = URL.split("//")[-1].split("/")[0] o = urllib.parse.urlparse(URL)
if URL.startswith("www."): except ValueError:
URL = URL[4:] # not a URL
return URL
except:
return None 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): def open_system_file_browser(path):