Skip to content

Fix PDF previews for Windows extended-length paths - #525

Merged
jsgrrchg merged 2 commits into
mainfrom
fix/windows-pdf-paths
Oct 9, 2026
Merged

jsgrrchg merged 2 commits into
mainfrom
fix/windows-pdf-paths

Conversation

@jsgrrchg

@jsgrrchg jsgrrchg commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Windows vault paths canonicalized by Rust use the extended-length prefix \\?\. The preview URL builder treated its ? as the start of a URL query, truncated the file path, and rejected PDFs inside the vault as being outside it before PDF.js could load them.

Preserve the Windows namespace when splitting URL suffixes, including extended UNC paths and forward-slash equivalents. Add regression coverage for PDF loading, preview authorization, generated image URLs, and files outside the vault.

Include a standalone integration suite that compiles a small Rust canonicalization helper, reads a generated PDF through the real preview handler, and loads its page operators with PDF.js. Run it with npx vitest run --config scripts/pdf-windows-paths.vitest.config.ts from apps/desktop with Rust installed. The OneDrive-like test directory is local; it does not exercise cloud synchronization.

Validation:

  • PDF path unit and integration checks passed on both Windows and Linux in GitHub Actions. The temporary workflow has been removed after validation; the tests remain available.
  • 59 focused preview/viewer tests and 2 filesystem/PDF.js integration tests passed locally on Linux.
  • Five new regression cases fail with the original implementation and pass with the fix.
  • TypeScript build checks, ESLint for changed TypeScript files, and diff whitespace checks passed.
  • The user's exact environment has not been reproduced.

Related to #519.

@jsgrrchg
jsgrrchg merged commit 4a62a51 into main Oct 9, 2026
20 checks passed
@jsgrrchg
jsgrrchg deleted the fix/windows-pdf-paths branch October 9, 2026 21:44
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.

1 participant