From 7bea63ae4b85f0c4ff0009e65b5358fcfa994f64 Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Sun, 7 Feb 2021 19:12:57 +0100 Subject: [PATCH] =?UTF-8?q?runDialog:=20Don=E2=80=99t=20treat=20empty=20in?= =?UTF-8?q?put=20specially?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let empty input result in an error, just like other invalid commands (bad syntax, nonempty whitespace, etc.). GLib already has an error message “Text was empty (or contained only whitespace)” which it shows for whitespace-only input, so letting that message apply also to empty input makes sense. This requires some tweaks further down the file to avoid interpreting empty input as an empty path (relative to the home directory) and then opening the home directory. Part of https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3183. Part-of: --- js/ui/runDialog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 356a97436..114aa1b26 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -189,7 +189,7 @@ class RunDialog extends ModalDialog.ModalDialog { f = null; if (f) { f(); - } else if (input) { + } else { try { if (inTerminal) { let exec = this._terminalSettings.get_string(EXEC_KEY); @@ -202,13 +202,13 @@ class RunDialog extends ModalDialog.ModalDialog { let path = null; if (input.charAt(0) == '/') { path = input; - } else { + } else if (input) { if (input.charAt(0) == '~') input = input.slice(1); path = '%s/%s'.format(GLib.get_home_dir(), input); } - if (GLib.file_test(path, GLib.FileTest.EXISTS)) { + if (path && GLib.file_test(path, GLib.FileTest.EXISTS)) { let file = Gio.file_new_for_path(path); try { Gio.app_info_launch_default_for_uri(file.get_uri(),