Merge branch 'rumpelsepp-master'

This commit is contained in:
Florian Bruhin 2016-05-18 23:55:49 +02:00
commit 93989c035f
3 changed files with 7 additions and 7 deletions

View File

@ -186,6 +186,7 @@ Contributors, sorted by the number of commits in descending order:
* neeasade
* jnphilipp
* Tobias Patzl
* Stefan Tatschner
* Peter Michely
* Link
* Larry Hynes
@ -210,7 +211,6 @@ Contributors, sorted by the number of commits in descending order:
* Tobias Werth
* Tim Harder
* Thiago Barroso Perrotta
* Stefan Tatschner
* Sorokin Alexei
* Samuel Loury
* Matthias Lisin

View File

@ -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()

View File

@ -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."""