Bug: Turkish Locale - Potential Header/Key resolution failure due to case-insensitive TreeMap serialization
还没有人认领这个 Issue。
评估
调研方向
从 openai-java-core/src/main/kotlin/com/openai/core/http/Headers.kt 中的 TreeMap 初始化处开始。在土耳其语操作系统区域设置下复现标头查找或令牌解析,并验证比较不受区域设置影响。当无论主机区域设置如何,OpenAI-Organization 等标准标头都能一致解析时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Bug Description
Applications utilizing this SDK on a Turkish OS locale face unexpected anomalies or token crashes during HTTP header parsing.
Root Cause
In openai-java-core/src/main/kotlin/com/openai/core/http/Headers.kt (Line 38), the headers map is initialized using a locale-dependent comparison mechanism:
private val map: MutableMap<String, MutableList<String>> =
TreeMap(String.CASE_INSENSITIVE_ORDER)
Java's native String.CASE_INSENSITIVE_ORDER internally triggers Character.toLowerCase(). On a Turkish host machine, this converts the capital letter I in "OpenAI-Organization" into a dotless ı, turning it into "openaı-organization".
This causes key lookup failures or broken token states when downstream interceptors (like OkHttp) process standard ASCII headers.
Related Upstream Issue
This is the Java/Kotlin ecosystem equivalent of the localization bug found in the Node SDK.
- Linked Node Issue: https://github.com/openai/openai-node/issues/1928
Suggested Official Fix
The TreeMap should enforce a locale-invariant comparator (such as Locale.ROOT) to guarantee strict ASCII/English-based casing rules across all operating systems:
TreeMap { s1, s2 -> s1.lowercase(java.util.Locale.ROOT).compareTo(s2.lowercase(java.util.Locale.ROOT)) }
- 主要语言
- Kotlin
- 星标
- 1.5k
- 派生
- 264
- 平均合并
- 13 小时 31 分钟
- 30 天内合并 PR
- 89
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openai/openai-java 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
openai/openai-java#890 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
openai/openai-java#886 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-java#802 · 2 条评论 · 3 个 reaction ·
-
bug sdk
难度 2/5 1-3 小时 新手友好度 72/100
openai/openai-java#652 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 74/100
openai/openai-java#973 ·
查看 openai/openai-java 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Issue: Bug
难度 1/5 1 小时以内 新手友好度 91/100
OpenAPITools/openapi-generator#24978 ·
-
helsemelding-json-schema json-schema-core
难度 2/5 1-3 小时 新手友好度 68/100
-
contributor: external needs review
难度 2/5 1-3 小时 新手友好度 82/100