fix: resolve PDF upload validation when bibliography file is uploaded… #173
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.
Fix: Resolve PDF upload validation when bibliography file is uploaded after PDFs
Summary
matchedFiles.length > 0tototalFiles > 0Description
After changing the import flow to make PDFs mandatory and bibliography files optional (allowing PDFs to be uploaded first), files were not being uploaded to MinIO storage when PDFs were uploaded before the bibliography file. The upload only worked when the bibliography file was uploaded first, then PDFs second.
Root Cause
The validation logic in
usePdfUploadLogic.tswas checking formatchedFiles.length > 0to determine if the upload was valid. When PDFs are uploaded before bibliography data exists, all files are categorized as "unmatched", resulting in an emptymatchedFilesarray. This causedisValidto befalse, preventing the workflow from proceeding to the MinIO upload step.Solution
Related Tickets & Documents
Closes #172
What type of PR is this?
Steps to QA
Test Case 1: Upload PDFs first, then bibliography
Test Case 2: Upload bibliography first, then PDFs (original flow)
Test Case 3: Upload only PDFs (no bibliography)
Files Modified
extralit-frontend/components/features/import/file-upload/usePdfUploadLogic.tsemitUpdate()validation logicChecklist
Before (Bug):
After (Fixed):
Additional Notes
This fix is part of the larger effort to make the bibliography file optional in the import workflow. Future PRs will handle additional scenarios where only PDFs are uploaded without any bibliography metadata.