fix: use shared validators in merge, split and protect PDF endpoints#297
Merged
Durgeshwar-AI merged 1 commit intoJun 14, 2026
Conversation
|
@pericharlabindhumadhavi-data is attempting to deploy a commit to the Durgeshwar's projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
@pericharlabindhumadhavi-data please fix the merge conflicts. |
…F endpoints, remove split_pdf.py deleted in upstream
2972824 to
b06bd1a
Compare
Contributor
Author
|
Hi @Durgeshwar-AI! |
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.
🔀 Pull Request
📌 Issue Reference
Closes #273
📝 Summary
Problem
The PDF Merge, Split, and Protect endpoints were using manual
.pdfextension checks instead of the shared validation helpers available inutils/validators.py.This caused:
fitz.FileDataError, which could lead to errors when corrupted PDF files were uploaded.Solution
This PR replaces the manual PDF validation logic with the shared
validate_uploaded_file()andvalidate_pdf_file()helper functions.Additionally,
merge_pdf.pynow catchesfitz.FileDataErrorand returns a user-friendly error message when an invalid or corrupted PDF is uploaded.Changes Made
validate_uploaded_file().validate_pdf_file()..endswith(".pdf")validation checks.fitz.FileDataErrorhandling inmerge_pdf.py.✅ Checklist
🔗 Related Issues / PRs
🏅 Open Source Program Participation
Program Name: GSSoC 2026 (GirlScript Summer of Code)
💬 Additional Notes
Testing Performed