Skip to content

fix(line): add file type to media download handler#26386

Closed
kevinWangSheng wants to merge 3 commits intoopenclaw:mainfrom
kevinWangSheng:fix/line-file-download
Closed

fix(line): add file type to media download handler#26386
kevinWangSheng wants to merge 3 commits intoopenclaw:mainfrom
kevinWangSheng:fix/line-file-download

Conversation

@kevinWangSheng
Copy link

@kevinWangSheng kevinWangSheng commented Feb 25, 2026

Summary

The LINE plugin was not downloading file attachments (PDF, Word, Excel, JSON, etc.) because the media download condition only checked for image, video, and audio types.

Changes

  • Added message.type === "file" to the media download condition in src/line/bot-handlers.ts
  • Files are now downloaded and made available to the agent, consistent with other media types

Before

if (message.type === "image" || message.type === "video" || message.type === "audio") {

After

if (
  message.type === "image" ||
  message.type === "video" ||
  message.type === "audio" ||
  message.type === "file"
) {

Test Plan

  • Existing tests pass (4/4 in bot-handlers.test.ts)
  • LINE Messaging API supports file message type with the same Content API as other media

Fixes #26330

Greptile Summary

Added message.type === "file" to the media download condition in handleMessageEvent so that file attachments (PDF, Word, Excel, JSON, etc.) are now downloaded and made available to the agent. The change is consistent with existing handling for image, video, and audio types, and the extractMediaPlaceholder function in bot-message-context.ts:167-168 already includes file type support with the <media:document> placeholder. The downloadLineMedia function uses the same LINE Messaging API Content endpoint for all media types.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is minimal (adding one message type check), follows existing patterns exactly, existing tests pass, and the supporting infrastructure already handles file types correctly (the extractMediaPlaceholder function already returns <media:document> for file types, and downloadLineMedia works with any message type via the same API)
  • No files require special attention

Last reviewed commit: 34e2238

shenghui kevin and others added 3 commits February 28, 2026 09:17
The LINE plugin was not downloading file attachments (PDF, Word, Excel,
JSON, etc.) because the media download condition only checked for
image, video, and audio types.

Added `message.type === "file"` to the condition so files are downloaded
and made available to the agent, consistent with other media types.

Fixes openclaw#26330
@vincentkoc
Copy link
Member

Deep review pass complete and branch updated.

I rebased onto current main, kept the fix scope on LINE media handling, and added a regression test that verifies file messages trigger downloadLineMedia(...) and pass media refs through to buildLineMessageContext(...).

I also refactored media-type eligibility into an explicit helper guard to reduce future drift when message-type support evolves.

@Takhoffman
Copy link
Contributor

Superseded by #32546, which consolidates this LINE workstream into the merged canonical fix set.

@Takhoffman Takhoffman closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LINE] File message type not downloaded (PDF, Word, etc.)

3 participants