feat: add mime_type to ByteStream in LibreOfficeFileConverter#3057
Conversation
There was a problem hiding this comment.
Pull request overview
Adds MIME type detection to LibreOfficeFileConverter so returned ByteStream outputs include mime_type, improving downstream handling (fixes #3055).
Changes:
- Introduces a
_resolve_mime_type()helper usingmimetypes.guess_type()with an extension-based fallback map. - Populates
mime_typeonByteStreamoutputs in bothrunandrun_async.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Friendly ping — PR is ready for review. Happy to address any feedback. Thanks! |
julian-risch
left a comment
There was a problem hiding this comment.
Looks good to me! Thank you for your contribution @StealthTensor and congratulations on your first haystack-core-integrations pull request! I extended the existing integration tests to check that the mime type is returned.
I also looked into adding more/extending existing unit tests to test the new mime types in the unit tests but it seemed overly complicated and increased complexity of the tests a lot. I didn't run integration tests locally, only unit tests because of installation steps.
Related Issues
mime_typeto the returnedByteStreams fromLibreOfficeFileConverter#3055Proposed Changes:
Added a
_resolve_mime_typehelper method to ensure themime_typefield is properly populated when returningByteStreamobjects.mimetypes.guess_type().None, it safely falls back to a deterministicMIME_TYPE_FALLBACKSdictionary based on the output file's extension.runandrun_asyncexecution paths.How did you test it?
Ran the local unit test suite using
hatch run test:unitinside theintegrations/libreofficedirectory. All tests passed successfully without any regressions.Notes for the reviewer
Thanks for tagging this as a good first issue! I didn't add any new unit tests since the existing suite covers the
ByteStreamcreation, but let me know if you want a specific test added for the MIME resolution or if you need any tweaks to the fallback dictionary.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.