@@ -7,7 +7,8 @@ import axios from '@nextcloud/axios'
77import { addNewFileMenuEntry , Permission , getSidebar } from '@nextcloud/files'
88import type { NewMenuEntry , IFolder , INode } from '@nextcloud/files'
99import { registerDavProperty } from '@nextcloud/files/dav'
10- import { getClient , getRootPath , resultToNode } from '@nextcloud/files/dav'
10+ import { getClient , getDefaultPropfind , getRootPath , resultToNode } from '@nextcloud/files/dav'
11+ import { loadState } from '@nextcloud/initial-state'
1112import { t } from '@nextcloud/l10n'
1213import { generateOcsUrl } from '@nextcloud/router'
1314import { getUploader } from '@nextcloud/upload'
@@ -41,6 +42,9 @@ addNewFileMenuEntry({
4142 uploadManager : getUploader ( ) ,
4243 order : 1 ,
4344 enabled ( context : IFolder ) {
45+ if ( ! loadState ( 'libresign' , 'certificate_ok' , false ) ) {
46+ return false
47+ }
4448 return ( context . permissions & Permission . CREATE ) !== 0
4549 } ,
4650 async handler ( this : ExtendedNewMenuEntry , context : IFolder , content : INode [ ] ) {
@@ -65,14 +69,17 @@ addNewFileMenuEntry({
6569 name : file . name ,
6670 } )
6771
68- // Fetch the complete node object from the Files API
72+ // Fetch the complete node object including Nextcloud-specific props (fileid, etc.)
6973 const client = getClient ( )
70- const result = await client . stat ( `${ getRootPath ( ) } ${ path } ` , { details : true } ) as ResponseDataDetailed < FileStat >
74+ const result = await client . stat ( `${ getRootPath ( ) } ${ path } ` , {
75+ details : true ,
76+ data : getDefaultPropfind ( ) ,
77+ } ) as ResponseDataDetailed < FileStat >
7178 const node = resultToNode ( result . data )
7279
7380 // Open sidebar with LibreSign tab
7481 const sidebar = getSidebar ( )
75- sidebar . open ( node , 'libresign' )
82+ await sidebar . open ( node , 'libresign' )
7683 sidebar . setActiveTab ( 'libresign' )
7784 }
7885
0 commit comments