[gnome-shell-extensions/wip/rstrode/heads-up-display: 56/62] general: launch only executable files




commit 23c99c0561a5c1cc1e69c41223631f5fefcac115
Author: Sergio Costas <raster rastersoft com>
Date:   Thu Jul 25 00:12:09 2019 +0200

    general: launch only executable files
    
    Until now, if a file has the "execute" flag, clicking on it will try
    to execute it, no matter if it is really an executable. This means
    that a non-executable file (like a JPEG picture, or a text file)
    won't be opened with its desired application if it has set the
    executable flag.
    
    This patch fixes this, by ensuring that the only files that can be
    executed when the "execute" flag is set, are the ones that makes
    sense to execute.
    
    Fixes https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/issues/144

 extensions/desktop-icons/fileItem.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/extensions/desktop-icons/fileItem.js b/extensions/desktop-icons/fileItem.js
index 5d3195f..143cb9b 100644
--- a/extensions/desktop-icons/fileItem.js
+++ b/extensions/desktop-icons/fileItem.js
@@ -443,10 +443,13 @@ var FileItem = class {
             return;
         }
 
-        if (this._attributeCanExecute && !this._isDirectory && !this._isValidDesktopFile) {
-            if (this._execLine)
-                Util.spawnCommandLine(this._execLine);
-            return;
+        if (this._attributeCanExecute &&
+           !this._isDirectory &&
+           !this._isValidDesktopFile &&
+            Gio.content_type_can_be_executable(this._attributeContentType)) {
+                if (this._execLine)
+                    Util.spawnCommandLine(this._execLine);
+                return;
         }
 
         Gio.AppInfo.launch_default_for_uri_async(this.file.get_uri(),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]