[gnome-shell] runDialog: Don’t treat empty input specially
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] runDialog: Don’t treat empty input specially
- Date: Mon, 8 Feb 2021 08:17:49 +0000 (UTC)
commit 7bea63ae4b85f0c4ff0009e65b5358fcfa994f64
Author: Lucas Werkmeister <mail lucaswerkmeister de>
Date: Sun Feb 7 19:12:57 2021 +0100
runDialog: Don’t treat empty input specially
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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1442>
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 356a974363..114aa1b265 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(),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]