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>
This commit is contained in:
parent
473e77e2c5
commit
7bea63ae4b
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user