actually implement https_force option
This commit is contained in:
parent
1f8db41656
commit
a4b362214a
|
@ -506,33 +506,35 @@ class WebTab(BuilderBase, Gtk.Box):
|
|||
keyword = None
|
||||
address = None
|
||||
|
||||
if Path(full_url).exists():
|
||||
full_url = f'local://{full_url}'
|
||||
with self.db.session as s:
|
||||
if Path(full_url).exists():
|
||||
full_url = f'local://{full_url}'
|
||||
|
||||
full_url = Url(full_url)
|
||||
full_url = Url(full_url)
|
||||
|
||||
if not full_url.domain and full_url.path and not full_url.proto:
|
||||
try:
|
||||
url = Url('https://' + full_url)
|
||||
except ValueError:
|
||||
self.window.notification(f'Not a valid url: {full_url}')
|
||||
return
|
||||
if not full_url.domain and full_url.path and not full_url.proto:
|
||||
proto = 'https' if s.get_config('https_force') else 'http'
|
||||
|
||||
else:
|
||||
url = Url(full_url)
|
||||
try:
|
||||
url = Url(f'{proto}://{full_url}')
|
||||
|
||||
# Can't register the ftp protocol, so use an alternative scheme name
|
||||
if full_url.proto == 'ftp':
|
||||
logging.verbose('ftp url. Redirecting to filetp instead')
|
||||
url = full_url.replace_property('proto', 'filetp')
|
||||
except ValueError:
|
||||
return self.window.notification(f'Not a valid url: {full_url}')
|
||||
|
||||
# Can't register the file protocol either
|
||||
elif full_url.proto == 'file':
|
||||
logging.verbose('file url. Redirecting to local instead')
|
||||
url = full_url.replace_property('proto', 'local')
|
||||
else:
|
||||
url = Url(full_url)
|
||||
|
||||
elif not full_url.proto:
|
||||
with self.db.session as s:
|
||||
# Can't register the ftp protocol, so use an alternative scheme name
|
||||
if full_url.proto == 'ftp':
|
||||
logging.verbose('ftp url. Redirecting to filetp instead')
|
||||
url = full_url.replace_property('proto', 'filetp')
|
||||
|
||||
# Can't register the file protocol either
|
||||
elif full_url.proto == 'file':
|
||||
logging.verbose('file url. Redirecting to local instead')
|
||||
url = full_url.replace_property('proto', 'local')
|
||||
|
||||
elif not full_url.proto:
|
||||
## Check the first word is a search keyword
|
||||
try:
|
||||
keyword, data = full_url.split(' ', 1)
|
||||
|
|
Reference in a new issue