feat: accept JPG/JPEG uploads alongside PDF (full pipeline support) - #126
Merged
Conversation
…c-byte gate, Bedrock image block)
…c-byte gate, Bedrock image block)
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.
What
Extends the invoice upload pipeline to accept
.jpg/.jpegfiles in addition to.pdf.End-to-end: file picker → S3 presigned PUT → GuardDuty gate → magic-byte gate →
Bedrock extraction (image block) → validation → persistence.
Why
Currently only PDF invoices are accepted. JPEG scans of invoices are common
(phone photos, scanner outputs) and Amazon Bedrock Nova supports image extraction
natively — no additional cost or infra change needed.
Changes
Backend
UploadService.csAllowedExtensions+MimeTypesstatic dicts; replaced PDF-only check; dynamiccontentTypepassed to presigned URL;FileTypeset from extension.IInvoiceExtractor.csfileTypeparameter ("pdf"|"jpeg") toExtractAsync.NovaInvoiceExtractor.csImageBlock(JPEG) orDocumentBlock(PDF) accordingly in the Bedrock Converse request.ExtractionWorker.cs%PDF-(PDF) andFF D8 FF(JPEG); passesdetectedTypeto extractor; updated error message.DocAnalytics.Service.csprojMicrosoft.IdentityModel.Protocols+Protocols.OpenIdConnectto 8.20.0 (pre-existing version-mismatch warning from Dependabot JWT bump).Frontend
upload.component.htmlaccept→.pdf,.jpg,.jpeg,.zip; updated hint text.upload.component.tsexpandToPdfs()allow JPEG; dynamic MIME type when constructingFilefrom ZIP entries.upload.service.tsfile.typeinstead of hardcodedapplication/pdf.Tests
CreateUploadAsync_accepts_jpg_fileandCreateUploadAsync_accepts_jpeg_extension.Behaviour notes
because Nova reads JPEGs visually (OCR) vs PDF text-layer. The validator's
ERR_BEDROCK_LOWCONFgate applies equally to both — this is correct behaviour.image/jpeg) and the browserPUT now sends the matching
Content-Typeheader.Checklist