Fix file creation issue if no action are registered

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2022-10-14 09:17:01 +02:00 committed by Vincent Petry
parent 4a448f31b2
commit a2d29eddf4
No known key found for this signature in database
GPG key ID: E055D6A4D513575C

View 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) {