From 1c238152f7e896a5edd38bbc8b16c7b3dd44cd43 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 18 May 2016 16:20:03 +0200 Subject: [PATCH 1/3] Fix crash when hovering over an invalid URL --- qutebrowser/mainwindow/statusbar/url.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index 6c01b8cfe..4d8e6e2a0 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -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() From 2c7dc6ffccfcafb81af7cf57fd950ba2891002df Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 18 May 2016 16:20:20 +0200 Subject: [PATCH 2/3] Add invalid url to 'test_set_hover_url_encoded' This covers the recently introduced code path, in 1c23815 (Fix crash when hovering over an invalid URL, 2016-05-18) when hovering an invalid URL. --- tests/unit/mainwindow/statusbar/test_url.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/mainwindow/statusbar/test_url.py b/tests/unit/mainwindow/statusbar/test_url.py index b4397f999..588ad2672 100644 --- a/tests/unit/mainwindow/statusbar/test_url.py +++ b/tests/unit/mainwindow/statusbar/test_url.py @@ -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.""" From 01e2fb37a0d7cbf816fbf71ba78cfe12ce060550 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 18 May 2016 23:55:43 +0200 Subject: [PATCH 3/3] Regenerate authors --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 5f59a9bbb..4b9c2f1d0 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -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