parent
248a3cd7a0
commit
10bc05eaea
|
@ -88,52 +88,17 @@ async function getFilesInternal2(fileIds: number[]): Promise<IFileInfo[]> {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://jsonformatter.org/xml-formatter
|
||||||
const filter = fileIds
|
const filter = fileIds
|
||||||
.map(
|
.map((fileId) => `<d:eq><d:prop><oc:fileid/></d:prop><d:literal>${fileId}</d:literal></d:eq>`)
|
||||||
(fileId) => `
|
|
||||||
<d:eq>
|
|
||||||
<d:prop>
|
|
||||||
<oc:fileid/>
|
|
||||||
</d:prop>
|
|
||||||
<d:literal>${fileId}</d:literal>
|
|
||||||
</d:eq>
|
|
||||||
`
|
|
||||||
)
|
|
||||||
.join('');
|
.join('');
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: 'SEARCH',
|
method: 'SEARCH',
|
||||||
headers: {
|
headers: { 'content-Type': 'text/xml' },
|
||||||
'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>`,
|
||||||
},
|
|
||||||
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,
|
deep: true,
|
||||||
details: true,
|
details: true,
|
||||||
responseType: 'text',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const response: any = await client.getDirectoryContents('', options);
|
const response: any = await client.getDirectoryContents('', options);
|
||||||
|
|
Loading…
Reference in New Issue