Fix PDF download error for documents without PDF files #358
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 DOCHUB-1V7 - Fix ValueError when accessing documents without PDF files
This issue was causing 32,121 errors affecting 411 users when they tried to download documents that don't have a PDF file associated with them.
Changes
document_pdf_fileview to return 404 if document has no PDF filedocument_original_fileview to return 404 if document has no original fileBehavior
Test plan
Impact
This will fix the Sentry issue and provide a better user experience by always offering a download option, even for documents that haven't been converted to PDF yet.
🤖 Generated with Claude Code