Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-02-02 21:30:20 +0300
committerJulius Härtl <jus@bitgrid.net>2021-02-02 21:54:20 +0300
commita9637828959145858eccda5ae88b17f82a49a265 (patch)
treeddd23c7e311d668b4543cec998c41598d53fb3f2
parent4fc23321489b43b44e9b6ffa4b84775f909cf9de (diff)
Properly catch missing context elements
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--src/files.js8
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') + '"/>'))