YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Fix local media markdown links (#3619)
Isaac Sanchez-Hawkins5a5832fd126f
diff --git a/apps/screenpipe-app-tauri/lib/utils/media-file-path.test.ts b/apps/screenpipe-app-tauri/lib/utils/media-file-path.test.tsindex ffb2eefd7..16fc5c8f9 100644--- a/apps/screenpipe-app-tauri/lib/utils/media-file-path.test.ts+++ b/apps/screenpipe-app-tauri/lib/utils/media-file-path.test.ts@@ -66,4 +66,13 @@ describe("normalizeLocalMediaMarkdown", () => {"- When you were talking: _2026-05-25_11-27-00.mp4>)",);});++ it("wraps local media links that contain spaces and parentheses", () => {+ const markdown =+ "[play clip](/Users/ansh/.screenpipe/data/System Audio (output)_2026-05-25_11-27-00.mp4)";++ expect(normalizeLocalMediaMarkdown(markdown)).toBe(+ "[play clip](</Users/ansh/.screenpipe/data/System Audio (output)_2026-05-25_11-27-00.mp4>)",+ );+ });});diff --git a/apps/screenpipe-app-tauri/lib/utils/media-file-path.ts b/apps/screenpipe-app-tauri/lib/utils/media-file-path.tsindex 23cf99f53..230581449 100644--- a/apps/screenpipe-app-tauri/lib/utils/media-file-path.ts+++ b/apps/screenpipe-app-tauri/lib/utils/media-file-path.ts@@ -43,13 +43,13 @@ export function isMediaFilePath(path: string): boolean {export function normalizeLocalMediaMarkdown(text: string): string {return text.replace(- new RegExp(`!\\[([^\\]]*)\\]\\(((?:/[^\n\r]+?|[A-Z]:[\\\\/][^\n\r]+?)\\.(${MEDIA_EXTENSION_PATTERN}))\\)`, "gi"),- (_match, alt: string, path: string) => {+ new RegExp(`(!?)\\[([^\\]]*)\\]\\(((?:/[^\n\r]+?|[A-Z]:[\\\\/][^\n\r]+?)\\.(${MEDIA_EXTENSION_PATTERN}))\\)`, "gi"),+ (_match, sigil: string, alt: string, path: string) => {const trimmedPath = path.trim();if (trimmedPath.startsWith("<") && trimmedPath.endsWith(">")) {- return ``;+ return `${sigil}[${alt}](${trimmedPath})`;}- return `}>)`;+ return `${sigil}[${alt}](<${trimmedPath.replace(/>/g, "%3E")}>)`;},);}