larksuite / larksuite/cli

[Bug][im] 下载消息附件时报 range response 长度异常

Open
#2,331 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug domain/im
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

问题描述

使用 im +messages-resources-download 下载飞书消息附件时失败。

附件为 JSON 文件,原始大小是 13067 字节,但 CLI 提示响应包含 13107 字节,比声明长度多 40 字节。

复现命令

lark-cli im +messages-resources-download \
  --as user \
  --message-id <message_id> \
  --file-key <file_key> \
  --type file \
  --output downloaded.json \
  --format json

使用 --as user 和 --as bot 都会失败。

错误信息
lark-cli 1.0.86:
range response delivered more than the 13067 bytes its framing declared

lark-cli 1.0.68:
chunk overflow: delivered 13107, expected 13067
预期行为
能够正常下载原始的 13067 字节文件。
环境
Windows
lark-cli 1.0.86
资源类型:file
文件名:1784686506840_101705.json
文件大小:13067 字节
测试文件见附件。真实的 message_id 和 file_key 可以按需私下提供。

[1784686506840_101705.json](https://github.com/user-attachments/files/31018097/1784686506840_101705.json)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of the im +messages-resources-download command and the range-response length validation. Reproduce the Windows download with the attached 13067-byte JSON file, then verify that the command writes exactly the original 13067 bytes for both user and bot authentication.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.