From cdaa32ae4e46d56c26a1ab945dfdde6439bd54ad Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 7 Dec 2023 10:10:53 +0000 Subject: [PATCH] Add AppInfo support to malcontent-client check-app-filter --- malcontent-client/malcontent-client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/malcontent-client/malcontent-client.py b/malcontent-client/malcontent-client.py index 5bc4731..051bc54 100644 --- a/malcontent-client/malcontent-client.py +++ b/malcontent-client/malcontent-client.py @@ -297,6 +297,7 @@ def command_check_app_filter(user, arg, quiet=False, interactive=True): # when passing flatpak IDs as argument is_maybe_content_type = not is_maybe_flatpak_id and is_valid_content_type(arg) is_maybe_path = os.path.exists(arg) + is_maybe_desktop_file = arg.endswith('.desktop') recognised_types = sum([is_maybe_flatpak_id, is_maybe_flatpak_ref, is_maybe_content_type, is_maybe_path]) @@ -320,6 +321,11 @@ def command_check_app_filter(user, arg, quiet=False, interactive=True): # Content type is_allowed = app_filter.is_content_type_allowed(arg) noun = 'Content type' + elif is_maybe_path and is_maybe_desktop_file + path = os.path.abspath(arg) + app_info = Gio.DesktopAppInfo.new_from_filename(path) + is_allowed = app_filter.is_appinfo_allowed(app_info) + noun = 'Desktop file' elif is_maybe_path: path = os.path.abspath(arg) is_allowed = app_filter.is_path_allowed(path)