Merge branch 'master' of https://github.com/rumpelsepp/qutebrowser into rumpelsepp-master
This commit is contained in:
commit
2b0f780500
@ -153,12 +153,11 @@ class UrlText(textbase.TextBase):
|
||||
_text: The text of the hovered link (string)
|
||||
"""
|
||||
if link:
|
||||
# We assume that `link` is always be given in a form that generates
|
||||
# a valid QUrl. If this proves to be wrong, we should probably
|
||||
# check and fall back to the text version otherwise.
|
||||
qurl = QUrl(link)
|
||||
assert qurl.isValid(), link
|
||||
self._hover_url = qurl.toDisplayString()
|
||||
if qurl.isValid():
|
||||
self._hover_url = qurl.toDisplayString()
|
||||
else:
|
||||
self._hover_url = link
|
||||
else:
|
||||
self._hover_url = None
|
||||
self._update_url()
|
||||
|
@ -94,7 +94,8 @@ def test_set_hover_url(url_widget, url_text, title, text):
|
||||
('http://test.ru/%D0%B0%D0%B1%D0%B2%D0%B3.txt', 'http://test.ru/абвг.txt'),
|
||||
('http://test.com/s%20p%20a%20c%20e.txt', 'http://test.com/s p a c e.txt'),
|
||||
('http://test.com/%22quotes%22.html', 'http://test.com/%22quotes%22.html'),
|
||||
('http://username:secret%20password@test.com', 'http://username@test.com')
|
||||
('http://username:secret%20password@test.com', 'http://username@test.com'),
|
||||
('http://example.com%5b/', 'http://example.com%5b/'), # invalid url
|
||||
])
|
||||
def test_set_hover_url_encoded(url_widget, url_text, expected):
|
||||
"""Test text when hovering over a percent encoded link."""
|
||||
|
Loading…
Reference in New Issue
Block a user