[sushi: 1/2] mimeHandler: check explicit membership before falling back



commit 501f1735dac06529c5068148d08c26ea82f106e9
Author: Joel Ong <joel hyad es>
Date:   Thu Jul 18 23:08:18 2019 +0000

    mimeHandler: check explicit membership before falling back

 src/ui/mimeHandler.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/mimeHandler.js b/src/ui/mimeHandler.js
index 7b914fe..4bfd79d 100644
--- a/src/ui/mimeHandler.js
+++ b/src/ui/mimeHandler.js
@@ -36,15 +36,19 @@ var getKlass = function(mime) {
         // first, try a direct match with the mimetype itself
         if (r.mimeTypes.includes(mime))
             return true;
-
-        // if this fails, try to see if we have any handlers
-        // registered for a parent type
-        if (r.mimeTypes.some((rm) => Gio.content_type_is_a(mime, rm)))
-            return true;
-
         return false;
     });
 
+    if (!renderer) {
+        renderer = renderers.find((r) => {
+            // if this fails, try to see if we have any handlers
+            // registered for a parent type
+            if (r.mimeTypes.some((rm) => Gio.content_type_is_a(mime, rm)))
+                return true;
+            return false;
+        });
+    }
+
     if (renderer)
         return renderer.Klass;
 


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