Skip to content

fix(im): deliver artifacts/presented files with real filename extension - #512

Merged
xfgong merged 1 commit into
mainfrom
fix/2026-08-20-im-filename-extension
Aug 20, 2026
Merged

fix(im): deliver artifacts/presented files with real filename extension#512
xfgong merged 1 commit into
mainfrom
fix/2026-08-20-im-filename-extension

Conversation

@xfgong

@xfgong xfgong commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #511. Feishu (and every send_file connector) derives the delivered file's identity and inline preview from the file_name we send. The artifact display name is often a human title with no extension, so it was sent as e.g. Quarterly Report and Feishu could not open the preview.

  • save_artifact (_try_deliver): prefer the real file basename from entry_file/path; fall back to the display name only when that basename has no extension.
  • present_file (_try_deliver_presented): derive a missing extension from mime_type via mimetypes.guess_extension.

The broken filename was set in the platform-agnostic IMArtifactDispatcher, so this also hardens Slack/Discord/Teams/DingTalk.

Test plan

  • Added regression tests in test_im_outbound_files.py and test_im_outbound_presented.py:
    • display name without extension → uses entry_file filename
    • entry_file takes priority over a display name that already has an extension
    • present_file with extensionless filename → extension filled from mime_type
    • already-extended filename → not double-appended
  • uv run pytest tests/integration/test_im_outbound_files.py tests/integration/test_im_outbound_presented.py → 22 passed
  • ruff check + ruff format --check clean on changed files

Feishu (and every send_file connector) derives the delivered file's identity
and inline preview from the file_name we send. The artifact display name is
often a human title with no extension, so it was sent as e.g. 'Quarterly
Report' and Feishu could not open the preview.

- save_artifact: prefer the real file basename from entry_file/path, fall back
  to the display name only when that basename has no extension.
- present_file: derive a missing extension from the mime type.

Adds regression tests in test_im_outbound_files.py and
test_im_outbound_presented.py.

Fixes #511
@github-actions github-actions Bot added bug Something isn't working backend Backend code labels Aug 20, 2026
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@xfgong
xfgong merged commit 3c1480c into main Aug 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend code bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu IM delivery drops file extension (save_artifact / present_file send artifact name, not filename)

1 participant