diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-02-02 21:30:20 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-02-02 21:54:20 +0300 |
commit | a9637828959145858eccda5ae88b17f82a49a265 (patch) | |
tree | ddd23c7e311d668b4543cec998c41598d53fb3f2 /src | |
parent | 4fc23321489b43b44e9b6ffa4b84775f909cf9de (diff) |
Properly catch missing context elements
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/files.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/files.js b/src/files.js index 3c657941..04a2b6d2 100644 --- a/src/files.js +++ b/src/files.js @@ -39,7 +39,7 @@ const odfViewer = { OC.imagePath('core', 'actions/rename'), (fileName, context) => { const fileModel = context.fileList.findFile(fileName) - const shareOwnerId = fileModel.shareOwnerId + const shareOwnerId = fileModel?.shareOwnerId return this.onEdit(fileName, { ...context, shareOwnerId }) }, t('richdocuments', 'Edit with {productName}', { productName: OC.getCapabilities().richdocuments.productName }, undefined, { escape: false }) @@ -72,7 +72,7 @@ const odfViewer = { } odfViewer.open = true if (context) { - if (context.$file.attr('data-mounttype') === 'external-session') { + if (context?.$file?.attr('data-mounttype') === 'external-session') { OCP.Toast.error(t('richdocuments', 'Opening the file is not supported, since the credentials for the external storage are not available without a session'), { timeout: 0 }) @@ -80,7 +80,7 @@ const odfViewer = { return } var fileDir = context.dir - var fileId = context.fileId || context.$file.attr('data-id') + var fileId = context.fileId || context.$file?.attr('data-id') var templateId = context.templateId } FilesAppIntegration.startLoading() @@ -134,7 +134,7 @@ const odfViewer = { } if (context) { - reloadForFederationCSP(fileName, context.shareOwnerId) + reloadForFederationCSP(fileName, context?.shareOwnerId) } $('head').append($('<link rel="stylesheet" type="text/css" href="' + OC.filePath('richdocuments', 'css', 'mobile.css') + '"/>')) |