Skip to content

Commit

Permalink
Merge pull request #34595 from nextcloud/fix/invalid-template
Browse files Browse the repository at this point in the history
Fix file creation issue if no action are registered
  • Loading branch information
szaimen authored Oct 14, 2022
2 parents f49ccd1 + 32c847b commit eb911d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
19 changes: 11 additions & 8 deletions apps/files/src/views/TemplatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit eb911d3

Please sign in to comment.