Skip to content

fix(cli): printJSON 输出 URL 时 & 被转义为 \u0026#60

Merged
riba2534 merged 1 commit intoriba2534:mainfrom
whatmele:fix/printjson-html-escape
Mar 29, 2026
Merged

fix(cli): printJSON 输出 URL 时 & 被转义为 \u0026#60
riba2534 merged 1 commit intoriba2534:mainfrom
whatmele:fix/printjson-html-escape

Conversation

@whatmele
Copy link
Copy Markdown
Contributor

@whatmele whatmele commented Mar 27, 2026

Summary

  • printJSON 使用 json.MarshalIndent 序列化时,Go 默认对 & 做 HTML 安全转义为 \u0026,导致 auth login --print-url 输出的 auth_url 不可直接使用
  • 改用 json.NewEncoder + SetEscapeHTML(false) 禁用 HTML 转义

Test plan

  • go build ./... 编译通过
  • go vet ./... 静态检查通过
  • go test ./... 全部测试通过
  • feishu-cli auth login --print-url 验证 URL 中 & 不再被转义

Go 的 json.MarshalIndent 默认对 &、<、> 做 HTML 安全转义,
导致 `auth login --print-url` 输出的 auth_url 中 & 变为 \u0026,
用户无法直接复制使用。

改用 json.NewEncoder + SetEscapeHTML(false) 禁用 HTML 转义。

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants