address all mentionned issues except for file://
- re-encode url using QUrl.RemovePassword | QUrl.FullyEncoded - improve readability for clipboard / primary selection code block
This commit is contained in:
parent
f16f425cb1
commit
c6ad23f921
@ -166,7 +166,7 @@ def get_filename_question(*, suggested_filename, url, parent=None):
|
|||||||
q.title = "Save file to:"
|
q.title = "Save file to:"
|
||||||
q.text = "Please enter a location for <b>{}</b>".format(
|
q.text = "Please enter a location for <b>{}</b>".format(
|
||||||
html.escape(url.toDisplayString()))
|
html.escape(url.toDisplayString()))
|
||||||
q.url = url.toString(QUrl.RemoveUserInfo)
|
q.url = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
q.mode = usertypes.PromptMode.download
|
q.mode = usertypes.PromptMode.download
|
||||||
q.completed.connect(q.deleteLater)
|
q.completed.connect(q.deleteLater)
|
||||||
q.default = _path_suggestion(suggested_filename)
|
q.default = _path_suggestion(suggested_filename)
|
||||||
|
@ -62,7 +62,7 @@ def authentication_required(url, authenticator, abort_on):
|
|||||||
else:
|
else:
|
||||||
msg = '<b>{}</b> needs authentication'.format(
|
msg = '<b>{}</b> needs authentication'.format(
|
||||||
html.escape(url.toDisplayString()))
|
html.escape(url.toDisplayString()))
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
answer = message.ask(title="Authentication required", text=msg,
|
answer = message.ask(title="Authentication required", text=msg,
|
||||||
mode=usertypes.PromptMode.user_pwd,
|
mode=usertypes.PromptMode.user_pwd,
|
||||||
abort_on=abort_on, url=urlstr)
|
abort_on=abort_on, url=urlstr)
|
||||||
@ -80,7 +80,7 @@ def javascript_confirm(url, js_msg, abort_on):
|
|||||||
|
|
||||||
msg = 'From <b>{}</b>:<br/>{}'.format(html.escape(url.toDisplayString()),
|
msg = 'From <b>{}</b>:<br/>{}'.format(html.escape(url.toDisplayString()),
|
||||||
html.escape(js_msg))
|
html.escape(js_msg))
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
ans = message.ask('Javascript confirm', msg,
|
ans = message.ask('Javascript confirm', msg,
|
||||||
mode=usertypes.PromptMode.yesno,
|
mode=usertypes.PromptMode.yesno,
|
||||||
abort_on=abort_on, url=urlstr)
|
abort_on=abort_on, url=urlstr)
|
||||||
@ -97,7 +97,7 @@ def javascript_prompt(url, js_msg, default, abort_on):
|
|||||||
|
|
||||||
msg = '<b>{}</b> asks:<br/>{}'.format(html.escape(url.toDisplayString()),
|
msg = '<b>{}</b> asks:<br/>{}'.format(html.escape(url.toDisplayString()),
|
||||||
html.escape(js_msg))
|
html.escape(js_msg))
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
answer = message.ask('Javascript prompt', msg,
|
answer = message.ask('Javascript prompt', msg,
|
||||||
mode=usertypes.PromptMode.text,
|
mode=usertypes.PromptMode.text,
|
||||||
default=default,
|
default=default,
|
||||||
@ -120,7 +120,7 @@ def javascript_alert(url, js_msg, abort_on):
|
|||||||
|
|
||||||
msg = 'From <b>{}</b>:<br/>{}'.format(html.escape(url.toDisplayString()),
|
msg = 'From <b>{}</b>:<br/>{}'.format(html.escape(url.toDisplayString()),
|
||||||
html.escape(js_msg))
|
html.escape(js_msg))
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
message.ask('Javascript alert', msg, mode=usertypes.PromptMode.alert,
|
message.ask('Javascript alert', msg, mode=usertypes.PromptMode.alert,
|
||||||
abort_on=abort_on, url=urlstr)
|
abort_on=abort_on, url=urlstr)
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ def ignore_certificate_errors(url, errors, abort_on):
|
|||||||
""".strip())
|
""".strip())
|
||||||
msg = err_template.render(url=url, errors=errors)
|
msg = err_template.render(url=url, errors=errors)
|
||||||
|
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
ignore = message.ask(title="Certificate errors - continue?", text=msg,
|
ignore = message.ask(title="Certificate errors - continue?", text=msg,
|
||||||
mode=usertypes.PromptMode.yesno, default=False,
|
mode=usertypes.PromptMode.yesno, default=False,
|
||||||
abort_on=abort_on, url=urlstr)
|
abort_on=abort_on, url=urlstr)
|
||||||
@ -208,7 +208,7 @@ def feature_permission(url, option, msg, yes_action, no_action, abort_on):
|
|||||||
config_val = config.instance.get(option)
|
config_val = config.instance.get(option)
|
||||||
if config_val == 'ask':
|
if config_val == 'ask':
|
||||||
if url.isValid():
|
if url.isValid():
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
text = "Allow the website at <b>{}</b> to {}?".format(
|
text = "Allow the website at <b>{}</b> to {}?".format(
|
||||||
html.escape(url.toDisplayString()), msg)
|
html.escape(url.toDisplayString()), msg)
|
||||||
else:
|
else:
|
||||||
|
@ -753,7 +753,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
"""Called when a proxy needs authentication."""
|
"""Called when a proxy needs authentication."""
|
||||||
msg = "<b>{}</b> requires a username and password.".format(
|
msg = "<b>{}</b> requires a username and password.".format(
|
||||||
html_utils.escape(proxy_host))
|
html_utils.escape(proxy_host))
|
||||||
urlstr = url.toString(QUrl.RemoveUserInfo)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
answer = message.ask(
|
answer = message.ask(
|
||||||
title="Proxy authentication required", text=msg,
|
title="Proxy authentication required", text=msg,
|
||||||
mode=usertypes.PromptMode.user_pwd,
|
mode=usertypes.PromptMode.user_pwd,
|
||||||
|
@ -148,7 +148,7 @@ class BrowserPage(QWebPage):
|
|||||||
text="URL: <b>{}</b>".format(
|
text="URL: <b>{}</b>".format(
|
||||||
html.escape(url.toDisplayString())),
|
html.escape(url.toDisplayString())),
|
||||||
yes_action=functools.partial(QDesktopServices.openUrl, url),
|
yes_action=functools.partial(QDesktopServices.openUrl, url),
|
||||||
url=urlstr)
|
url=info.url.toString(QUrl.FullyEncoded))
|
||||||
return True
|
return True
|
||||||
elif (info.domain, info.error) in ignored_errors:
|
elif (info.domain, info.error) in ignored_errors:
|
||||||
log.webview.debug("Ignored error on {}: {} (error domain: {}, "
|
log.webview.debug("Ignored error on {}: {} (error domain: {}, "
|
||||||
|
@ -432,16 +432,16 @@ class PromptContainer(QWidget):
|
|||||||
sel: Use the primary selection instead of the clipboard.
|
sel: Use the primary selection instead of the clipboard.
|
||||||
"""
|
"""
|
||||||
question = self._prompt.question
|
question = self._prompt.question
|
||||||
if not question.url:
|
if question.url is None:
|
||||||
message.error('No URL found.')
|
message.error('No URL found.')
|
||||||
return
|
return
|
||||||
s = question.url
|
if sel and utils.supports_selection():
|
||||||
target = 'primary selection'
|
target = 'primary selection'
|
||||||
if not (sel and utils.supports_selection()):
|
else:
|
||||||
target = 'clipboard'
|
|
||||||
sel = False
|
sel = False
|
||||||
utils.set_clipboard(s, sel)
|
target = 'clipboard'
|
||||||
message.info("Yanked to {}: {}".format(target, s))
|
utils.set_clipboard(question.url, sel)
|
||||||
|
message.info("Yanked to {}: {}".format(target, question.url))
|
||||||
|
|
||||||
|
|
||||||
class LineEdit(QLineEdit):
|
class LineEdit(QLineEdit):
|
||||||
|
Loading…
Reference in New Issue
Block a user