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

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