fix: block image ingestion when OCR is disabled#1973
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Warning
|
Wallgau
left a comment
There was a problem hiding this comment.
Great job! Thank you Nishad!
Summary
Adds a check to stop image files from being ingested when OCR is disabled.
Images like
png,jpg,jpeg,bmp,tiff,tif, andwebpneed OCR to extract text. If OCR is turned off, these files now fail early with a clear error message:The file '<filename>' is an image file and cannot be ingested because OCR is disabled.This PR adds:
IMAGE_EXTENSIONSlistis_image_file()helperFor local uploads, the check runs before the file is hashed or processed.
For connector uploads, the check runs when the filename is first available, and again after the connector file is loaded in case the final filename changes.
When the check fails, the task is marked as
FAILED, the error is saved, and processing stops.