From a2d29eddf4dbe2a46fef054e6589871f6385d140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Fri, 14 Oct 2022 09:17:01 +0200 Subject: [PATCH] Fix file creation issue if no action are registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/src/views/TemplatePicker.vue | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/files/src/views/TemplatePicker.vue b/apps/files/src/views/TemplatePicker.vue index 3a1dc15b790..33b925aa2ed 100644 --- a/apps/files/src/views/TemplatePicker.vue +++ b/apps/files/src/views/TemplatePicker.vue @@ -215,20 +215,23 @@ export default { ) this.logger.debug('Created new file', fileInfo) + // Fetch FileInfo and model const data = await fileList?.addAndFetchFileInfo(this.name).then((status, data) => data) - const model = new OCA.Files.FileInfoModel(data, { filesClient: fileList?.filesClient, }) + // Run default action const fileAction = OCA.Files.fileActions.getDefaultFileAction(fileInfo.mime, 'file', OC.PERMISSION_ALL) - fileAction.action(fileInfo.basename, { - $file: fileList?.findFileEl(this.name), - dir: currentDirectory, - fileList, - fileActions: fileList?.fileActions, - fileInfoModel: model, - }) + if (fileAction) { + fileAction.action(fileInfo.basename, { + $file: fileList?.findFileEl(this.name), + dir: currentDirectory, + fileList, + fileActions: fileList?.fileActions, + fileInfoModel: model, + }) + } this.close() } catch (error) {