Repository navigation
Open PDFs locked with a password - #414
Merged
Merged
Conversation
Every PDF open (this thread and the PDF worker) goes through one opener that tries the passwords that opened a PDF before, then asks once, and keeps the one that worked in Obsidian's keychain on this device. Background reads never ask. The PDF on disk stays locked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Export, Ask AI's PDF and the Companion PDF: pdf-lib cannot read an encrypted source, so such a page is drawn as a picture through pdf.js. - Only the notebook view's PDF cache may show the dialog; Home covers, embeds, previews, the Companion and the template list never ask. - Imports from the device name the file in the dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After Cancel, a finger tap (or a right-click) on a page whose PDF stayed locked asks for the password again and draws the page afresh. Making a notebook from a PDF asks again even if its dialog was cancelled before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nder cannot store its old answer Found by the reviewer agent: a PDF unlocked by another notebook's dialog kept its locked mark, so a tap dropped its rasters instead of following a link; and a render still reading the file when the page was tapped stored its locked answer over the fresh read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/i18n/en/surface.ts # src/view/pdf-backdrop.ts
…iew only wires it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
PDFs that ask for a password when opened (university handouts, for example) could not be opened in FineNotes: no PDF opening ever gave pdf.js a password, so it refused with "No password given". Now every PDF opening, on the main thread and in the PDF worker, goes through one opener. It first tries the passwords that opened a PDF before, then asks once with a small dialog titled with the file's name. The password that works is kept in Obsidian's keychain on this device. Only the notebook itself asks. Home covers, page embeds, the Companion PDF, the template list and background reads (search text, OCR, the outline) use kept passwords and never show the dialog. After Cancel, a tap on the locked page (a right-click on desktop) asks again, and making a notebook from the PDF always asks. Export, Ask AI's PDF and the Companion PDF draw a locked source's pages as pictures: pdf-lib cannot copy an encrypted page. The PDF on disk stays locked.
Proof
PasswordException 1 No password given. A PDF with only an owner password (printing and copying blocked) already opened.PdfLocked.PdfLockedwith no dialog, and an interactive open asks, flags a wrong password and keeps the right one.forgetnow cancels the path's running renders, which also covers a PDF replaced on disk.tests/view/pdf-password-book.test.ts(11).tests/view/pdf-password.test.ts(8, pdf.js'sonPasswordprotocol played by a fake). They include three openings of one PDF at once asking only once, which failed before the fix to the dialog's turn.pdf-composer.test.ts: "names a PDF locked with a password…", on a real AES-256 fixture.pdf-backdrop.test.ts: the locked mark until forgotten; cleared when the worker unlocks it later; a forgotten PDF's running render stores nothing. The last two fail without their fixes.pdf-password.test.ts: "asks again for one declined PDF only".dialog-pdf-passwordanddialog-pdf-password-wrongin light and dark).npm run gates: all 11 steps pass.check.mjs --changedran every scene (shared files changed). Its 7 finding groups are the ones the nightly already reports on main (settings-advanced and 6 ellipsis groups); none are in the new dialog.Test on the device
Not verified
drift.mjssays locales normally follow by the translation routine; if that routine should own them, drop the locale hunks.ink-surface.tsgrew 3 lines (theonTapLockedPdfcallback and its one check, wiring only); its cap infile-size.jsonis raised by 3 in this PR.unreadable. Gates pass on the merge.🤖 Generated with Claude Code