Repository navigation
fix: map image/bmp to Pillow's BMP format instead of DIB - #13743
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@67-luck is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
anakin87
approved these changes
Nov 20, 2026
anakin87
left a comment
Member
There was a problem hiding this comment.
Thank you. I pushed a minor simplification.
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.
Related Issues
Proposed Changes:
MIME_TO_FORMAT(haystack/dataclasses/image_content.py) is built by invertingFORMAT_TO_MIME. Both"BMP"and"DIB"map to"image/bmp"there, and the later"DIB"entry wins, soimage/bmpwas mapped to Pillow's headerless DIB format. Whensizeis set,_encode_image_to_base64therefore:image/bmpinput withformats=["DIB"], which can't read a regular.bmpfile, soImageFileToImageContentandDocumentToImageContentlogged a warning and dropped it;"DIB", so the output didn't start with theBMheader but was still labeledimage/bmp.The fix maps
image/bmpback to"BMP"explicitly, next to the existingMIME_TO_FORMAT["image/jpg"] = "JPEG"override.IMAGE_MIME_TYPESis unchanged.How did you test it?
TestEncodeImageToBase64::test_encode_image_to_base64_downsize_bmp, parametrized overmime_type="image/bmp"andNone. Both cases fail onmain(UnidentifiedImageError, and data starting withb'(\x00'instead ofb'BM') and pass with this change.test/components/converters/image/test_image_utils.py,test_file_to_image.pyandtest/dataclasses/test_image_content.py: 47 passed. The 8 failures there come frompypdfium2not being installed locally and fail the same way onmain..bmpfile (0 → 1 result), and the re-encoded data starts withBM.ruff checkandruff format --checkpass.Notes for the reviewer
Release note:
releasenotes/notes/image-bmp-mime-format-3d8a1f6c2e9b4a70.yaml. I used Claude Code to prepare this change and reviewed and tested it myself.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.🤖 Generated with Claude Code