fix(wasm): accept a password in classifyPdf and extractText - #543
Open
devgabrielmarcondes wants to merge 1 commit into
Open
devgabrielmarcondes wants to merge 1 commit into
devgabrielmarcondes wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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
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.
processPdfanddetectPdfacceptoptions.password, butclassifyPdfandextractTexttake no options, so an encrypted PDF reachable through one entry point is unreachable through the other two. The asymmetry matters most forextractText, 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_passwordis 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_passwordconvention 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 isCopyand describes how items are reported rather than how the document is opened.Summary by cubic
Adds
options.passwordsupport to the WASMclassifyPdfandextractTextentry points, matchingprocessPdfanddetectPdf. Previously an encrypted PDF reachable through those two was unreachable through the other two, andextractTexthad no workaround since the only alternative returns Markdown.Core crate changes
classify_pdf_mem_with_passwordandextract_text_with_positions_mem_with_passwordentry points.None, so behavior is unchanged.PositionOptions, which isCopyand describes item reporting, not document opening.Written for commit 4b4cbf8. Summary will update on new commits.