From 3ced51b168e163427c0c185a5b76cf4e688c74d6 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 18 Jul 2025 16:47:33 +0200 Subject: [PATCH] fix(sync): error in xml parser --- .../sync/providers/webdav/webdav-xml-parser.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/pfapi/api/sync/providers/webdav/webdav-xml-parser.ts b/src/app/pfapi/api/sync/providers/webdav/webdav-xml-parser.ts index 4a1a5331b..2d83e8462 100644 --- a/src/app/pfapi/api/sync/providers/webdav/webdav-xml-parser.ts +++ b/src/app/pfapi/api/sync/providers/webdav/webdav-xml-parser.ts @@ -171,13 +171,19 @@ export class WebdavXmlParser { const decodedHref = decodeURIComponent(href); - // Skip the base path itself (we only want children) - // Normalize both paths: remove leading/trailing slashes for comparison - const normalizedHref = decodedHref.replace(/^\//, '').replace(/\/$/, ''); - const normalizedBasePath = basePath.replace(/^\//, '').replace(/\/$/, ''); + // For single file queries (when we're looking for a specific file), + // we should NOT skip the base path itself + // Only skip if it's a directory listing (ends with /) + const isDirectoryListing = basePath.endsWith('/'); + if (isDirectoryListing) { + // Skip the base path itself (we only want children) + // Normalize both paths: remove leading/trailing slashes for comparison + const normalizedHref = decodedHref.replace(/^\//, '').replace(/\/$/, ''); + const normalizedBasePath = basePath.replace(/^\//, '').replace(/\/$/, ''); - if (normalizedHref === normalizedBasePath) { - continue; + if (normalizedHref === normalizedBasePath) { + continue; + } } const fileMeta = this.parseXmlResponseElement(response, decodedHref);