From 49fd08b30d396bcb0ba9944aeca2973e830daa22 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 21 Jun 2014 23:19:59 +0200 Subject: [PATCH] Leave URLs encoded when setting commandline --- doc/BUGS | 4 ---- qutebrowser/browser/commands.py | 6 +++--- qutebrowser/browser/hints.py | 3 ++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/doc/BUGS b/doc/BUGS index ebf16ba11..389e04ba8 100644 --- a/doc/BUGS +++ b/doc/BUGS @@ -17,10 +17,6 @@ Bugs - Segfaults when trying to load http://cmpl.cc/downloads/hlwm-tablet.mkv and with youtube HTML5 player. -- URL detection and encoded spaces - - e.g. when trying to open a link with %20 interactively, or even via click. - - When quitting while being asked for a download filename: segfault / memory corruption diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 64c6fdd1a..4fcf6c426 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -457,19 +457,19 @@ class CommandDispatcher: @cmdutils.register(instance='mainwindow.tabs.cmd', hide=True) def open_tab_cur(self): """Set the statusbar to :tabopen and the current URL.""" - urlstr = self._current_url().toDisplayString() + urlstr = self._current_url().toDisplayString(QUrl.FullyEncoded) message.set_cmd_text(':open-tab ' + urlstr) @cmdutils.register(instance='mainwindow.tabs.cmd', hide=True) def open_cur(self): """Set the statusbar to :open and the current URL.""" - urlstr = self._current_url().toDisplayString() + urlstr = self._current_url().toDisplayString(QUrl.FullyEncoded) message.set_cmd_text(':open ' + urlstr) @cmdutils.register(instance='mainwindow.tabs.cmd', hide=True) def open_tab_bg_cur(self): """Set the statusbar to :tabopen-bg and the current URL.""" - urlstr = self._current_url().toDisplayString() + urlstr = self._current_url().toDisplayString(QUrl.FullyEncoded) message.set_cmd_text(':open-tab-bg ' + urlstr) @cmdutils.register(instance='mainwindow.tabs.cmd') diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index b834d1f4e..281cdb0cc 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -320,8 +320,9 @@ class HintManager(QObject): Target.cmd_tab: 'open-tab', Target.cmd_tab_bg: 'open-tab-bg', } + urlstr = url.toDisplayString(QUrl.FullyEncoded) message.set_cmd_text(':{} {}'.format(commands[self._context.target], - url.toDisplayString())) + urlstr)) def _download(self, url): """Download a hint URL.