Skip to content

fix: skip non-string MIME metadata in DocumentTypeRouter - #12793

Open
MohammadHijjawi97 wants to merge 1 commit into
deepset-ai:mainfrom
MohammadHijjawi97:fix/document-type-router-non-str-mime
Open

MohammadHijjawi97 wants to merge 1 commit into
deepset-ai:mainfrom
MohammadHijjawi97:fix/document-type-router-non-str-mime

Conversation

@MohammadHijjawi97

Copy link
Copy Markdown
Contributor

Related Issues

No existing issue. This PR includes a regression test for the crash.

Proposed Changes:

Proposed Changes:

DocumentTypeRouter passed mime_type metadata to re.fullmatch. A list or integer value raised TypeError. Treat non-string MIME metadata as missing and route those documents to unclassified. Also guard invalid file_path values when guessing MIME type.

How did you test it?

Added a unit test for list, integer, and None mime metadata next to a valid string.

Notes for the reviewer

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.

re.fullmatch requires a string. List or integer mime_type metadata raised TypeError.
@MohammadHijjawi97
MohammadHijjawi97 requested a review from a team as a code owner September 17, 2026 11:05
@MohammadHijjawi97
MohammadHijjawi97 requested review from julian-risch and removed request for a team September 17, 2026 11:05
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @MohammadHijjawi97, thanks for your interest in contributing to Haystack! 🙏

⚠️ You currently have 5 open pull requests in this repository (#12794, #12792, #12791, #12790 and this one). Our review capacity is limited, so please hold off opening more PRs until we've had a chance to review your first 2 open PRs. This helps us give each contribution the attention it deserves. Thank you!

This is an automated message to help us keep the review queue healthy.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @MohammadHijjawi97, thanks a lot for your contribution! 🙏

We noticed that the Contributor License Agreement (CLA) check (license/cla) hasn't passed yet, so we've temporarily moved this PR to draft and paused the review assignment.

To get your PR reviewed, please sign the CLA via the link in the license/cla check below (or in the CLA bot comment). As soon as the check turns green, this PR will automatically be marked ready for review again and a reviewer will be re-assigned.

@HaystackBot
HaystackBot removed the request for review from julian-risch September 17, 2026 12:39
@HaystackBot HaystackBot added the cla-pending PR is in draft until the contributor signs the CLA label Sep 17, 2026
@HaystackBot
HaystackBot marked this pull request as draft September 17, 2026 12:39
@HaystackBot
HaystackBot marked this pull request as ready for review September 19, 2026 08:51
@HaystackBot

Copy link
Copy Markdown
Contributor

Thanks for signing the CLA, @MohammadHijjawi97! 🎉 This PR is now ready for review again and the reviewer has been re-assigned.

@HaystackBot HaystackBot removed the cla-pending PR is in draft until the contributor signs the CLA label Sep 19, 2026
@MohammadHijjawi97

Copy link
Copy Markdown
Contributor Author

CLA is signed now. This is ready for review whenever you have time.

@MohammadHijjawi97
MohammadHijjawi97 force-pushed the fix/document-type-router-non-str-mime branch from b4c934d to 76c9dea Compare September 25, 2026 08:30
@github-actions github-actions Bot added the type:documentation Improvements on the docs label Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/routers
  document_type_router.py 144-145
  haystack/core/pipeline
  pipeline.py
Project Total  

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

This branch has not been deployed

No deployments
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.

4 participants