From e81974e9ff4fe97a4c12d8700f10ec41e67de8dd Mon Sep 17 00:00:00 2001 From: Jaime Idolpx Date: Sun, 7 Jun 2026 18:32:13 -0400 Subject: [PATCH] fix: improve path handling in toEntryInfo function to correctly use entry.uri for reliable path resolution --- src/app/webdav.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/webdav.ts b/src/app/webdav.ts index cae0721..448b2dd 100644 --- a/src/app/webdav.ts +++ b/src/app/webdav.ts @@ -132,7 +132,13 @@ function pathFromUri(uri: string, baseUrl: string): string { } function toEntryInfo(e: WebDAVEntry, baseUrl: string): EntryInfo { - const rawPath = e.path && e.path.length > 0 ? e.path : e.uri; + // The vendored `webdav-component` computes `entry.path` by stripping + // `baseUrl.length` from the href — that only works when the server + // sends absolute hrefs (e.g. `http://localhost/sd/foo`). When the + // server sends relative hrefs (`/sd/foo`), the strip chops off the + // start of the path. Use `entry.uri` directly instead, which the + // parser sets verbatim from the href and is always reliable. + const rawPath = (e.uri && e.uri.length > 0 ? e.uri : e.path) || ''; const fullPath = pathFromUri(rawPath, baseUrl); // Prefer the server-provided displayname when it looks like a leaf // (no slashes). Some servers (notably older webdav3.py) used to