Skip to content

Commit 65abdfc

Browse files
committed
fix: use Object.hasOwn instead of in operator for model validation
- Fixes normalizeClaudeCodeModelId() to avoid using 'in' operator which can match inherited properties like 'toString' - Adds missing translations for Claude Code authentication error messages to all 17 locales
1 parent 4094b84 commit 65abdfc

File tree

18 files changed

+54
-19
lines changed

18 files changed

+54
-19
lines changed

packages/types/src/providers/claude-code.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ const MODEL_FAMILY_PATTERNS: Array<{ pattern: RegExp; target: ClaudeCodeModelId
136136
*/
137137
export function normalizeClaudeCodeModelId(modelId: string): ClaudeCodeModelId {
138138
// If already a valid model ID, return as-is
139-
if (modelId in claudeCodeModels) {
139+
// Use Object.hasOwn() instead of 'in' operator to avoid matching inherited properties like 'toString'
140+
if (Object.hasOwn(claudeCodeModels, modelId)) {
140141
return modelId as ClaudeCodeModelId
141142
}
142143

143144
// Strip date suffix if present (e.g., -20250514)
144145
const withoutDate = modelId.replace(DATE_SUFFIX_PATTERN, "")
145146

146147
// Check if stripping the date makes it valid
147-
if (withoutDate in claudeCodeModels) {
148+
if (Object.hasOwn(claudeCodeModels, withoutDate)) {
148149
return withoutDate as ClaudeCodeModelId
149150
}
150151

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/id/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/it/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/ja/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/ko/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)