Etemplate: Avoid error if file_data.mime is false for some reason

(file missing)
This commit is contained in:
nathangray 2020-07-10 11:11:05 -06:00
parent 63a320ca35
commit 510a6419c5
2 changed files with 2 additions and 2 deletions

View File

@ -947,7 +947,7 @@ var et2_vfsUpload = /** @class */ (function (_super) {
if (file_data && (typeof file_data.download_url != 'undefined')) { if (file_data && (typeof file_data.download_url != 'undefined')) {
var fe_mime = egw_get_file_editor_prefered_mimes(file_data.mime); 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 // 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]))) { (file_data.mime.match(mime.mime_regexp, 'ig') || (fe_mime && fe_mime.mime[file_data.mime]))) {
vfs_attrs.onclick = function (ev) { vfs_attrs.onclick = function (ev) {
ev.stopPropagation(); ev.stopPropagation();

View File

@ -1092,7 +1092,7 @@ class et2_vfsUpload extends et2_file
{ {
var fe_mime = egw_get_file_editor_prefered_mimes(file_data.mime); 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 // 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]))) (file_data.mime.match(mime.mime_regexp,'ig') || (fe_mime && fe_mime.mime[file_data.mime])))
{ {
vfs_attrs.onclick = function(ev) { vfs_attrs.onclick = function(ev) {