diff options
author | Simon L <szaimen@e.mail.de> | 2022-10-14 10:42:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 10:42:13 +0200 |
commit | eb911d344d950ee68a023b90b799c7ab16edbd63 (patch) | |
tree | 6eccd8731763e98abec8ee91156b282b17145c08 /apps | |
parent | f49ccd140fd5ada0aa640f6642464ad149c980e6 (diff) | |
parent | 32c847b08c99b05a9655be7e03d5531cad198aa0 (diff) | |
download | nextcloud-server-eb911d344d950ee68a023b90b799c7ab16edbd63.tar.gz nextcloud-server-eb911d344d950ee68a023b90b799c7ab16edbd63.zip |
Merge pull request #34595 from nextcloud/fix/invalid-template
Fix file creation issue if no action are registered
Diffstat (limited to 'apps')
-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) { |