Skip to content

[Bug] PDF reader broken: the pdfjs asset scheme registration dropped knownote-doc's privileges #135

Description

@mrsibe

Symptom

Opening any PDF fails. The renderer console shows:

Fetch API cannot load knownote-doc://docs/doc_...: URL scheme "knownote-doc" is not supported.
Failed to open PDF TypeError: Failed to fetch. URL scheme "knownote-doc" is not supported.

The whole reader is dead. Introduced by #131 (the CJK asset fix).

Root cause

protocol.registerSchemesAsPrivileged() replaces the privilege table; it does not append. #131 added a second, separate call:

registerDocumentScheme()      // knownote-doc
registerPdfjsAssetScheme()    // knownote-asset  ← overwrites the table

so knownote-doc lost supportFetchAPI and the renderer's fetch() on it failed. protocol.handle itself keeps working in the main process, which is why nothing else noticed.

The packaged smoke test did not catch it because its knownote-doc:// check ran through the main process (net.fetch), which does not need the renderer-facing privilege.

Fix

  • Protocol modules only declare their scheme (declareDocumentScheme() / declarePdfjsAssetScheme()).
  • privilegedSchemes.ts::applyPrivilegedSchemes() performs the single registerSchemesAsPrivileged() call, invoked once from index.ts before the app is ready.
  • smokeTest now also fetches knownote-doc:// from a real renderer, which is the level at which this broke.

Acceptance

  • PDF reader opens documents again (dev and packaged)
  • both knownote-doc:// and knownote-asset:// are fetchable from the renderer
  • there is exactly one registerSchemesAsPrivileged() call site in src/
  • smoke:packaged fails if the document scheme loses its privilege

Related

Activity

  1. added this to the v1.4 milestone on Sep 25, 2026
  2. added
    bugSomething isn't working
    area:infraBuild, packaging, CI, dependencies
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:infraBuild, packaging, CI, dependenciesbugSomething isn't working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions