parent
248a3cd7a0
commit
10bc05eaea
|
@ -88,52 +88,17 @@ async function getFilesInternal2(fileIds: number[]): Promise<IFileInfo[]> {
|
|||
return [];
|
||||
}
|
||||
|
||||
// https://jsonformatter.org/xml-formatter
|
||||
const filter = fileIds
|
||||
.map(
|
||||
(fileId) => `
|
||||
<d:eq>
|
||||
<d:prop>
|
||||
<oc:fileid/>
|
||||
</d:prop>
|
||||
<d:literal>${fileId}</d:literal>
|
||||
</d:eq>
|
||||
`
|
||||
)
|
||||
.map((fileId) => `<d:eq><d:prop><oc:fileid/></d:prop><d:literal>${fileId}</d:literal></d:eq>`)
|
||||
.join('');
|
||||
|
||||
const options = {
|
||||
method: 'SEARCH',
|
||||
headers: {
|
||||
'content-Type': 'text/xml',
|
||||
},
|
||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<d:searchrequest xmlns:d="DAV:"
|
||||
xmlns:oc="http://owncloud.org/ns"
|
||||
xmlns:nc="http://nextcloud.org/ns"
|
||||
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns"
|
||||
xmlns:ocs="http://open-collaboration-services.org/ns">
|
||||
<d:basicsearch>
|
||||
<d:select>
|
||||
<d:prop>
|
||||
<oc:fileid />
|
||||
</d:prop>
|
||||
</d:select>
|
||||
<d:from>
|
||||
<d:scope>
|
||||
<d:href>${prefixPath}</d:href>
|
||||
<d:depth>0</d:depth>
|
||||
</d:scope>
|
||||
</d:from>
|
||||
<d:where>
|
||||
<d:or>
|
||||
${filter}
|
||||
</d:or>
|
||||
</d:where>
|
||||
</d:basicsearch>
|
||||
</d:searchrequest>`,
|
||||
headers: { 'content-Type': 'text/xml' },
|
||||
data: `<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ns="https://github.com/icewind1991/SearchDAV/ns" xmlns:ocs="http://open-collaboration-services.org/ns"><d:basicsearch><d:select><d:prop><oc:fileid /></d:prop></d:select><d:from><d:scope><d:href>${prefixPath}</d:href><d:depth>0</d:depth></d:scope></d:from><d:where><d:or>${filter}</d:or></d:where></d:basicsearch></d:searchrequest>`,
|
||||
deep: true,
|
||||
details: true,
|
||||
responseType: 'text',
|
||||
};
|
||||
|
||||
const response: any = await client.getDirectoryContents('', options);
|
||||
|
|
Loading…
Reference in New Issue