Repository navigation
Conversation
PdfSplitHandle used UploadedFile.chunks(), which ZipExtFile lacks. ZipSplitHandle then swallowed the AttributeError, so PDF-only zip uploads returned an empty split list with no logs. Write the buffer from get_buffer instead, and log zip member split failures. Fixes 1Panel-dev#7436
Contributor
Author
|
Closing: opened against |
2 of 3 tasks
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.
Summary
Fixes #7436.
Uploading a zip that only contains PDFs returned an empty split list with no server logs, while uploading the same PDF alone worked.
Root cause:
PdfSplitHandle.handleread the file withUploadedFile.chunks(). Zip members arezipfile.ZipExtFile, which has nochunks(), so the call raisedAttributeError.ZipSplitHandlethen swallowed every exception withexcept Exception: pass, so PDF members were skipped silently.Change:
get_buffer(file)(same path Doc/HTML/XLSX already use), which works for bothUploadedFileandZipExtFile.max_kb.warninginstead of silentpass.Related prior attempt: #7448 (closed unmerged against an older
impl/text/layout).Test plan
apps/common/handle/impl/tests/test_pdf_zip_buffer.py(ZipExtFile-like object withoutchunks(); mocksfitz.open/ TOC path)AI disclosure
This pull request was prepared with assistance from an autonomous coding agent (Grok Bot). I reviewed the diff and take responsibility for the change.