fix(token-search): use TrimPrefix for sk- token normalization - #2928
Conversation
WalkthroughToken normalization logic in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fix(token-search): use TrimPrefix for sk- token normalization
PR 类型
PR 是否包含破坏性更新?
PR 描述
修复后端 token 搜索逻辑中的字符串处理问题。
在
SearchUserTokens中,原先使用strings.Trim(token, "sk-")对输入做处理,该方法会移除首尾所有属于s/k/-的字符,可能错误修改 token 内容,导致搜索匹配失败。本 PR 改为
strings.TrimPrefix(token, "sk-"),仅去除预期的sk-前缀,避免误删字符,恢复 token 搜索的正确性。Summary by CodeRabbit