Skip to content

fix(wasm): accept a password in classifyPdf and extractText - #543

Open
devgabrielmarcondes wants to merge 1 commit into
firecrawl:mainfrom
devgabrielmarcondes:fix/wasm-password-v2
Open

devgabrielmarcondes wants to merge 1 commit into
firecrawl:mainfrom
devgabrielmarcondes:fix/wasm-password-v2

Conversation

@devgabrielmarcondes

@devgabrielmarcondes devgabrielmarcondes commented Sep 18, 2026

Copy link
Copy Markdown

processPdf and detectPdf accept options.password, but classifyPdf and extractText take no options, so an encrypted PDF reachable through one entry point is unreachable through the other two. The asymmetry matters most for extractText, which has no workaround at all, since the only alternative returns Markdown while its purpose is plain text.

The wasm crate cannot close this on its own, because load_document_from_mem_with_password is pub(crate) and the only public password-aware extractor is path-based, which no browser can use. The core crate therefore gains two public entry points that follow the _with_password convention already used for the path variant, while the current functions delegate to them with None so that their behavior does not change.

The password stays out of PositionOptions, since that struct is Copy and describes how items are reported rather than how the document is opened.


Summary by cubic

Adds options.password support to the WASM classifyPdf and extractText entry points, matching processPdf and detectPdf. Previously an encrypted PDF reachable through those two was unreachable through the other two, and extractText had no workaround since the only alternative returns Markdown.

Core crate changes

  • Adds public classify_pdf_mem_with_password and extract_text_with_positions_mem_with_password entry points.
  • Existing functions delegate to them with None, so behavior is unchanged.
  • Keeps passwords out of PositionOptions, which is Copy and describes item reporting, not document opening.

Written for commit 4b4cbf8. Summary will update on new commits.

Review in cubic

processPdf and detectPdf accept options.password, but classifyPdf and
extractText took no options at all, so an encrypted PDF that is reachable
through one entry point was unreachable through the other two. extractText
has no workaround at all: the only alternative returns Markdown, and its
whole purpose is plain text.

The wasm crate cannot close this on its own: load_document_from_mem_with_password
is pub(crate), and the only public password-aware extractor is path-based,
which is unusable in a browser. Add two public entry points to the core
crate, following the _with_password naming that already exists for the
path variant, and have the current functions delegate to them with None
so their behavior is unchanged.

The password is kept out of PositionOptions: that struct is Copy and
describes how items are reported, not how the document is opened.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Adds password support to WASM classifyPdf and extractText, matching processPdf/detectPdf. New core functions delegate with None to preserve existing behavior; backward-compatible, bounded API addition.

Re-trigger cubic

This branch has not been deployed

No deployments
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