Skip to content

fix(frontend): encode thread IDs in chat routes#4302

Merged
WillemJiang merged 1 commit into
bytedance:mainfrom
18062706139fcz:fix/encode-thread-id-routes
Jul 19, 2026
Merged

fix(frontend): encode thread IDs in chat routes#4302
WillemJiang merged 1 commit into
bytedance:mainfrom
18062706139fcz:fix/encode-thread-id-routes

Conversation

@18062706139fcz

@18062706139fcz 18062706139fcz commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Why

Custom thread identifiers may contain URL-reserved characters such as # and ?. When they are inserted directly into chat route segments, the browser can interpret those characters as fragment or query delimiters and navigate to the wrong conversation.

What Changed

  • Encode thread IDs with encodeURIComponent inside pathOfThread() before building standard and agent chat URLs.
  • Keep the existing custom agent-name encoding behavior.
  • Add unit coverage for both standard chat routes and agent chat routes that contain reserved characters.
  • Document the thread-route construction convention.

Scenarios

  • Opening a standard chat route for a custom thread ID such as thread#1?draft.
  • Opening an agent chat route for a custom thread ID that contains reserved URL characters.

Validation

  • pnpm test tests/unit/core/threads/utils.test.ts
  • pnpm exec tsc --noEmit --incremental false

@github-actions github-actions Bot added area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ needs-validation Touches front/back contract surface; needs real-path validation risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines labels Jul 19, 2026
@WillemJiang
WillemJiang merged commit 532111b into bytedance:main Jul 19, 2026
14 checks passed
@WillemJiang WillemJiang added this to the 2.1.0 milestone Jul 19, 2026
yogyoho added a commit to yogyoho/eai-flow-main that referenced this pull request Jul 23, 2026
…UI hardening

- bytedance#4117 XSS hardening (isSafeHref, iframe sandbox, safeLocalStorage)
- bytedance#4354 streaming chunk batcher for large file tools
- bytedance#4294 LLM concurrency cap + burst-rate retry shedding
- bytedance#4355 E2B release serialization
- bytedance#4267 transient image context cleanup
- bytedance#4374 AI disclaimer (bytedance#4373 reasoning-effort default)
- bytedance#4337 /goal length validation + counter
- bytedance#4278/bytedance#4302/bytedance#4312 URL encoding fixes
- bytedance#4375 list_uploaded_files schema fix
- bytedance#4288 uploads markdown companion name claim
- bytedance#4258 remove frontend debug logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ needs-validation Touches front/back contract surface; needs real-path validation risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants