Skip to content

Preserve absolute media file paths#3845

Merged
louis030195 merged 2 commits into
screenpipe:mainfrom
isanchez404:fix/trim-quoted-media-path
Jun 7, 2026
Merged

Preserve absolute media file paths#3845
louis030195 merged 2 commits into
screenpipe:mainfrom
isanchez404:fix/trim-quoted-media-path

Conversation

@isanchez404

Copy link
Copy Markdown
Contributor

Summary

  • preserve absolute Unix media paths in normalizeMediaFilePath
  • keep the leading slash when decoding file:///Users/... URLs
  • trim outer whitespace before stripping surrounding quotes from media paths

Changed area

  • apps/screenpipe-app-tauri/lib/utils/media-file-path.ts
  • apps/screenpipe-app-tauri/lib/utils/media-file-path.test.ts

Validation

  • vet "Fix normalizeMediaFilePath so quoted file URLs and absolute Unix media paths normalize correctly" --agentic --agent-harness claude --history-loader "python3 ~/.codex/skills/vet/scripts/export_codex_session.py --session-file /Users/isaac.sanchez/.codex/sessions/2026/06/05/rollout-2026-06-05T09-01-02-019e97df-6c2f-73a0-826d-f4565aa6426d.jsonl" (initial run returned No issues found; later rerun hung with no findings emitted)
  • node --experimental-strip-types --input-type=module assertion check covering absolute Unix paths, Unix file:///... URLs, quoted Unix file URLs, and encoded Windows file URLs
  • git diff --check

Risk notes

  • low risk: the change is isolated to path normalization for local media references
  • Windows handling is preserved by keeping the existing drive-letter normalization path

Skipped-test rationale

  • bun x vitest run --config vitest.config.ts lib/utils/media-file-path.test.ts was blocked by error: bun is unable to write files to tempdir: PermissionDenied
  • bun run typecheck was blocked by the same Bun tempdir permission error

@louis030195 louis030195 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, unix paths are tricky

generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.


cleaned = cleaned.replace(/^file:\/+/i, "");
if (/^file:\/\/\/[A-Z]:[\\/]/i.test(cleaned)) {
cleaned = cleaned.replace(/^file:\/\/\//i, "");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe cleaned.replace(/^file:/+/i, "/") for unix to handle any slash count?

@louis030195 louis030195 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! tests pass nicely

generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.

@louis030195 louis030195 merged commit 60d8966 into screenpipe:main Jun 7, 2026
9 checks passed
louis030195 pushed a commit that referenced this pull request Jun 7, 2026
Strengthens the unit suites for the three Tier-1 fixes just merged:

- media-file-path (#3845): malformed percent-escapes, no-extension /
  empty / backtick inputs, case-insensitive ext, Windows forward-slash
  path in text, Unix audio-chunk path with spaces+parens; audio/media
  classifier casing; already-wrapped markdown link, > escaping, Windows
  path in a markdown link.
- context-pruning (#3854): malformed <conversation_history> blocks
  (unterminated, close-before-open) fall back to generic head+tail;
  multiple oversized text blocks clamped while non-text blocks untouched;
  non-string/non-array message content ignored; zero window from
  getContextUsage falls back to default.
- notification-toggle (#3794): notify rule detected across a blank line
  in the deny block; enable keeps permissions+allow children when only
  the notify deny rule existed; deny block retained when a non-notify
  rule remains.

Test-only. Full vitest suite green (486 tests). These functions are pure
modules; the wdio e2e suite mocks pi and drives whole-app UI, so the
deterministic edge-case layer for them is vitest (the context-pruning
suite is already documented as the extension's real e2e coverage).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants