From 6fac69ced38958cd9a74758314420f8ab47db7e7 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Thu, 17 Sep 2026 11:51:26 -0700 Subject: [PATCH] fix(desktop): label a Windows drive path by its basename new URL('C:\\Users\\x\\My Report.docx') parses with scheme `c:`, so the card label was the whole backslash path. A drive letter is a path, not a scheme; skip the URL branch for it. --- apps/desktop/src/lib/media.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/desktop/src/lib/media.ts b/apps/desktop/src/lib/media.ts index cd5d6b3c46..7847bc0e28 100644 --- a/apps/desktop/src/lib/media.ts +++ b/apps/desktop/src/lib/media.ts @@ -56,13 +56,16 @@ export function mediaMime(path: string): string { } export function mediaName(path: string): string { - try { - const url = new URL(path) - - return url.pathname.split('/').filter(Boolean).pop() || path - } catch { - return path.split(/[\\/]/).filter(Boolean).pop() || path + // `C:\Users\…` parses as a URL with scheme `c:`; a drive letter is a path, not a scheme. + if (!/^[A-Za-z]:[\\/]/.test(path)) { + try { + return new URL(path).pathname.split('/').filter(Boolean).pop() || path + } catch { + // not a URL — fall through to the path split + } } + + return path.split(/[\\/]/).filter(Boolean).pop() || path } export function mediaMarkdownHref(path: string): string {