[sushi: 1/2] mimeHandler: check explicit membership before falling back
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi: 1/2] mimeHandler: check explicit membership before falling back
- Date: Thu, 18 Jul 2019 23:08:32 +0000 (UTC)
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]