fix(feishu): address bot review feedback

- resolveUploadInput: remove length < 1024 guard on file path detection.
  Prefix patterns (isAbsolute / ~ / ./ / ../) already correctly distinguish
  file paths from base64 strings at any length. The old guard caused file
  paths ≥1024 chars to fall through to the base64 branch incorrectly.

- parseColorMarkup: add comment clarifying that mismatched closing tags
  (e.g. [red]text[/green]) are intentional — opening tag style is applied,
  closing tag is consumed regardless of name.
This commit is contained in:
Elarwei
2026-02-28 12:15:48 +08:00
committed by Tak Hoffman
parent 65acfa3781
commit 1bed7e5621

View File

@@ -55,7 +55,10 @@ interface Segment {
*/
export function parseColorMarkup(content: string): Segment[] {
const segments: Segment[] = [];
// Match [tag]...[/tag] or plain text between tags
// Match [tag]...[/tag] or plain text between tags.
// The closing tag name is intentionally not validated against the opening tag:
// mismatched tags like [red]text[/green] are treated as [red]text[/red] —
// the opening tag's style is applied and the closing tag is consumed.
const tagPattern = /\[([^\]]+)\](.*?)\[\/(?:[^\]]+)\]|([^[]+)/gs;
let match;