Skip to content

fix: set FileContent filename from ByteStream meta in FileToFileContent - #13831

Merged
sjrl merged 2 commits into
mainfrom
fix/file-to-file-content-bytestream-filename
Nov 20, 2026
Merged

sjrl merged 2 commits into
mainfrom
fix/file-to-file-content-bytestream-filename

Conversation

@sjrl

@sjrl sjrl commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Related Issues

  • No issue opened

Proposed Changes:

FileToFileContent only set FileContent.filename when the source was a path. For ByteStream sources it was always None, so OpenAIResponsesChatGenerator sent the placeholder "filename" to OpenAI.

This shows up when files arrive as ByteStreams from an upload API, which is how deepset AI Platform passes files into query pipelines (with meta["file_name"] set and the bytes stored under a file ID path).

For ByteStream sources the filename now comes from meta["file_name"], or else from the base name of meta["file_path"] (the key get_bytestream_from_source and the other converters use).

How did you test it?

Added a parametrized unit test covering file_name, file_path, and both set. Ran test/components/converters/test_file_to_file_content.py locally.

Notes for the reviewer

file_name takes precedence over file_path because an upload's stored path often has a generated name (e.g. <uuid>.pdf) rather than the original one.

Checklist

@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
haystack-docs Ignored Ignored Preview Nov 20, 2026 11:11am UTC

Request Review

@sjrl sjrl self-assigned this Nov 20, 2026
@github-actions github-actions Bot added the type:documentation Improvements on the docs label Nov 20, 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/converters
  file_to_file_content.py
Project Total  

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

@sjrl
sjrl marked this pull request as ready for review November 20, 2026 11:12
@sjrl
sjrl requested a review from a team as a code owner November 20, 2026 11:12
@sjrl
sjrl requested review from davidsbatista and removed request for a team November 20, 2026 11:12

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍🏽

@sjrl
sjrl merged commit 7549ad9 into main Nov 20, 2026
28 of 29 checks passed
@sjrl
sjrl deleted the fix/file-to-file-content-bytestream-filename branch November 20, 2026 12:31
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.

2 participants