Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.2
alacarte
fix-bad-command-validation.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-bad-command-validation.patch of Package alacarte
diff --git a/Alacarte/ItemEditor.py b/Alacarte/ItemEditor.py index 9fd9faa..c5de30c 100644 --- a/Alacarte/ItemEditor.py +++ b/Alacarte/ItemEditor.py @@ -178,14 +178,22 @@ class LauncherEditor(ItemEditor): self.builder.get_object('icon-image')) self.builder.get_object('exec-browse').connect('clicked', self.pick_exec) - self.builder.get_object('name-entry').connect('changed', self.resync_validity) self.builder.get_object('exec-entry').connect('changed', self.resync_validity) + def exec_line_is_valid(self, exec_text): + try: + success, parsed = GLib.shell_parse_argv(exec_text) + # Make sure program (first part of the command) is in the path + command = parsed[0] + return (GLib.find_program_in_path(command) is not None) + except GLib.GError: + return False + def resync_validity(self, *args): name_text = self.builder.get_object('name-entry').get_text() exec_text = self.builder.get_object('exec-entry').get_text() - valid = (name_text != "" and GLib.find_program_in_path(exec_text) is not None) + valid = (name_text != "" and self.exec_line_is_valid(exec_text)) self.builder.get_object('ok').set_sensitive(valid) def load(self):
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor