Skip to content

fix: keep the detected MIME type when FileTypeRouter attaches meta - #13419

Merged
anakin87 merged 3 commits into
deepset-ai:mainfrom
mittalpk:fix/file-type-router-meta-mime-type
Oct 27, 2026
Merged

anakin87 merged 3 commits into
deepset-ai:mainfrom
mittalpk:fix/file-type-router-meta-mime-type

Conversation

@mittalpk

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

When meta is passed, FileTypeRouter reads a path into a ByteStream so the metadata can be attached, but that ByteStream had mime_type=None even though the router had just detected the type. Downstream converters such as FileToFileContent then could not tell its type. The copy now carries the detected MIME type, and a ByteStream source keeps its own.

How did you test it?

Added test_run_with_meta_keeps_detected_mime_type_on_paths (fails without the fix) and test_run_with_meta_keeps_bytestream_mime_type. Router and converter-utils tests: 223 passed.

Notes for the reviewer

One-line change in FileTypeRouter.run, plus a release note.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@mittalpk
mittalpk requested a review from a team as a code owner October 23, 2026 22:41
@mittalpk
mittalpk requested review from anakin87 and removed request for a team October 23, 2026 22:41
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@mittalpk is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/routers
  file_type_router.py
  haystack/core/pipeline
  pipeline.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions github-actions Bot added the type:documentation Improvements on the docs label Oct 27, 2026

@anakin87 anakin87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I pushed a few simplifications

@anakin87
anakin87 enabled auto-merge (squash) October 27, 2026 15:10
@anakin87
anakin87 merged commit 71a9a7e into deepset-ai:main Oct 27, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileTypeRouter drops detected MIME type when metadata converts a Path to ByteStream

2 participants