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

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