diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-10-14 09:17:01 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-10-14 09:17:01 +0200 |
commit | 92c98864474d97e92fbe8028b8c1c44bcfca1dcb (patch) | |
tree | 461e84eee0c14f99055184521d2d0487d68c634a | |
parent | f49ccd140fd5ada0aa640f6642464ad149c980e6 (diff) | |
download | nextcloud-server-92c98864474d97e92fbe8028b8c1c44bcfca1dcb.tar.gz nextcloud-server-92c98864474d97e92fbe8028b8c1c44bcfca1dcb.zip |
Fix file creation issue if no action are registered
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
-rw-r--r-- | apps/files/src/views/TemplatePicker.vue | 19 |
1 files 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) { |