]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix file creation issue if no action are registered
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 14 Oct 2022 07:17:01 +0000 (09:17 +0200)
committerJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 14 Oct 2022 07:17:01 +0000 (09:17 +0200)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/files/src/views/TemplatePicker.vue

index 3a1dc15b79042f54b4040d41a5d79b268511d933..33b925aa2edb1ce729618f004800b10f830726c1 100644 (file)
@@ -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) {