Fix XML parsing for WebDav

This was a regression caused by the `@libs/xml` upgrade in v2.6.0
This commit is contained in:
Bruno Bernardino
2025-10-17 20:41:01 +01:00
parent 8d78e1f25c
commit 6280228759
4 changed files with 232 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ export function addDavPrefixToKeys(object: Record<string, any>, prefix = 'D:'):
if (typeof object === 'object' && object !== null) {
return Object.entries(object).reduce((reducedObject, [key, value]) => {
const prefixedKey = key === 'xml' || key.startsWith('#') || key.startsWith('@') ? key : `${prefix}${key}`;
const prefixedKey = key.startsWith('#') || key.startsWith('@') ? key : `${prefix}${key}`;
reducedObject[prefixedKey] = addDavPrefixToKeys(value);
return reducedObject;
}, {} as Record<string, any>);
@@ -105,10 +105,8 @@ export async function buildPropFindResponse(
const filePaths = await getFilePaths(join(rootPath, queryPath), depth);
const response: Record<string, any> = {
xml: {
'@version': '1.0',
'@encoding': 'UTF-8',
},
'@version': '1.0',
'@encoding': 'UTF-8',
multistatus: {
'@xmlns:D': 'DAV:',
response: [],