Blame SOURCES/0001-general-launch-only-executable-files.patch

987b2c
From ee89a91a9ac235b69ff3c47af14d702c0309e892 Mon Sep 17 00:00:00 2001
987b2c
From: Sergio Costas <raster@rastersoft.com>
987b2c
Date: Thu, 25 Jul 2019 00:12:09 +0200
987b2c
Subject: [PATCH] general: launch only executable files
987b2c
987b2c
Until now, if a file has the "execute" flag, clicking on it will try
987b2c
to execute it, no matter if it is really an executable. This means
987b2c
that a non-executable file (like a JPEG picture, or a text file)
987b2c
won't be opened with its desired application if it has set the
987b2c
executable flag.
987b2c
987b2c
This patch fixes this, by ensuring that the only files that can be
987b2c
executed when the "execute" flag is set, are the ones that makes
987b2c
sense to execute.
987b2c
987b2c
Fixes https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/issues/144
987b2c
---
987b2c
 extensions/desktop-icons/fileItem.js | 11 +++++++----
987b2c
 1 file changed, 7 insertions(+), 4 deletions(-)
987b2c
987b2c
diff --git a/extensions/desktop-icons/fileItem.js b/extensions/desktop-icons/fileItem.js
987b2c
index d6d43c9f..44a93352 100644
987b2c
--- a/extensions/desktop-icons/fileItem.js
987b2c
+++ b/extensions/desktop-icons/fileItem.js
987b2c
@@ -440,10 +440,13 @@ var FileItem = class {
987b2c
             return;
987b2c
         }
987b2c
 
987b2c
-        if (this._attributeCanExecute && !this._isDirectory && !this._isValidDesktopFile) {
987b2c
-            if (this._execLine)
987b2c
-                Util.spawnCommandLine(this._execLine);
987b2c
-            return;
987b2c
+        if (this._attributeCanExecute &&
987b2c
+           !this._isDirectory &&
987b2c
+           !this._isValidDesktopFile &&
987b2c
+            Gio.content_type_can_be_executable(this._attributeContentType)) {
987b2c
+                if (this._execLine)
987b2c
+                    Util.spawnCommandLine(this._execLine);
987b2c
+                return;
987b2c
         }
987b2c
 
987b2c
         Gio.AppInfo.launch_default_for_uri_async(this.file.get_uri(),
987b2c
-- 
987b2c
2.31.1
987b2c