Skip to content

[Feature]: Support LINE file message type (PDF, etc.) in inbound media download #27722

Description

@carrotRakko

Summary

Add file to the LINE inbound media download condition so documents (PDF, PPTX, etc.) sent via LINE are downloaded and available to the agent.

Problem to solve

When a LINE user sends a file (e.g. PDF), the message is received and a <media:document> placeholder is passed to the agent, but the actual file binary is not downloaded. The inbound media handler in bot-handlers.ts only checks for image | video | audio message types, so file messages skip the downloadLineMedia() call entirely. The LINE SDK's getMessageContent API supports file messages, so the binary is available but never fetched.

Proposed solution

Add message.type === "file" to the media download condition in bot-handlers.ts. The existing downloadLineMedia() pipeline (size limits, temp file storage, content-type detection) handles the rest. Optionally, leverage FileEventMessage.fileName to preserve the original filename and improve content-type detection (currently falls back to application/octet-stream / .bin for non-image/video/audio files).

Alternatives considered

Explicitly rejecting file messages with a user-facing explanation ("file uploads not supported"). This is weaker because the infrastructure to handle them already exists — only the condition check is missing.

Impact

  • Affected: LINE channel users who send documents to the bot
  • Severity: Medium — the bot receives the message but has no access to the file content, so it cannot meaningfully process document-based requests
  • Frequency: Every time a LINE user sends a file attachment
  • Consequence: Agent responds without the document context, leading to irrelevant or incomplete replies

Evidence/examples

bot-handlers.ts L227 — current condition: if (message.type === "image" || message.type === "video" || message.type === "audio"). LINE SDK FileEventMessage type includes fileName and fileSize properties, and documents that getMessageContent supports file messages.

Additional information

No security risk increase — file downloads go through the same pipeline as image/video/audio (size limits via mediaMaxMb, random temp file paths, no user input in file paths).

✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions