From 510a6419c51afc9d3dd06a25441150ff66cb8964 Mon Sep 17 00:00:00 2001 From: nathangray Date: Fri, 10 Jul 2020 11:11:05 -0600 Subject: [PATCH] Etemplate: Avoid error if file_data.mime is false for some reason (file missing) --- api/js/etemplate/et2_widget_vfs.js | 2 +- api/js/etemplate/et2_widget_vfs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_widget_vfs.js b/api/js/etemplate/et2_widget_vfs.js index aa92e9c22a..999a9c93cd 100644 --- a/api/js/etemplate/et2_widget_vfs.js +++ b/api/js/etemplate/et2_widget_vfs.js @@ -947,7 +947,7 @@ var et2_vfsUpload = /** @class */ (function (_super) { if (file_data && (typeof file_data.download_url != 'undefined')) { var fe_mime = egw_get_file_editor_prefered_mimes(file_data.mime); // Check if the link entry is mime with media type, in order to open it in expose view - if (typeof file_data.mime != 'undefined' && + if (typeof file_data.mime === 'string' && (file_data.mime.match(mime.mime_regexp, 'ig') || (fe_mime && fe_mime.mime[file_data.mime]))) { vfs_attrs.onclick = function (ev) { ev.stopPropagation(); diff --git a/api/js/etemplate/et2_widget_vfs.ts b/api/js/etemplate/et2_widget_vfs.ts index 3745080d56..347979c6af 100644 --- a/api/js/etemplate/et2_widget_vfs.ts +++ b/api/js/etemplate/et2_widget_vfs.ts @@ -1092,7 +1092,7 @@ class et2_vfsUpload extends et2_file { var fe_mime = egw_get_file_editor_prefered_mimes(file_data.mime); // Check if the link entry is mime with media type, in order to open it in expose view - if (typeof file_data.mime != 'undefined' && + if (typeof file_data.mime === 'string' && (file_data.mime.match(mime.mime_regexp,'ig') || (fe_mime && fe_mime.mime[file_data.mime]))) { vfs_attrs.onclick = function(ev) {