Conversation
|
Reviews (1): Last reviewed commit: "fix(agent): encode non-ascii gateway pro..." | Re-trigger Greptile |
770af36 to
1375a41
Compare
1375a41 to
82ec8b2
Compare
|
Thanks for digging into this. Closing as superseded: main fixed the same bug in #3375 by transliterating header values to ASCII in Percent-encoding also has two problems here: nothing decodes the values downstream, so titles would show up in analytics as If preserving CJK/emoji fidelity matters, that would need a change in the shared module plus a decode step on the gateway side. |
Problem
Slack-created PostHog Code tasks can fail when the task title contains non-ASCII characters. The original task title is forwarded as an
x-posthog-property-task_titleHTTP header value, and some HTTP clients reject header values containing characters outside the safe ASCII range.The original title should remain unchanged for storage and UI display. The unsafe boundary is only when the title is serialized into gateway property headers.
Fixes PostHog/posthog#65950.
Changes
encodeURIComponent.Why encode instead of strip?
Stripping non-ASCII characters makes the header safe, but loses user context. Encoding keeps the value ASCII-safe while preserving the original information in a reversible representation.
Examples:
How did you test this?
pnpm --filter @posthog/agent test gateway.test.tspnpm --filter @posthog/agent typecheck— fails locally due unresolved internal workspace packages such as@posthog/shared,@posthog/git, and@posthog/enricher; no errors are reported ingateway.tsorgateway.test.ts.