Skip to content

Commit 403284b

Browse files
nullvariantclaude
andauthored
fix: treat empty string as "not set" for optional fields (#124)
Empty strings in default config (service, sshKeyPath, sshHost, gpgKeyId) were causing validation errors on first install. This change skips validation for empty strings while keeping required fields protected. 🖥️ IDE: [Cursor](https://cursor.sh) 🔌 Extension: [Claude Code](https://claude.ai/download) Model-Raw: claude-opus-4-5-20251101 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f8fc492 commit 403284b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

extensions/git-id-switcher/src/configSchema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ function validateProperty(
129129
errors: SchemaError[]
130130
): void {
131131
// Type check
132-
if (value !== undefined && value !== null) {
132+
// Empty string is treated as "not set" for optional fields.
133+
// This allows default config with "" values to pass validation without errors.
134+
// SECURITY: Required fields (id, name, email) are still protected via else-if below.
135+
if (value !== undefined && value !== null && value !== '') {
133136
if (typeof value !== schema.type) {
134137
errors.push({
135138
field,

0 commit comments

Comments
 (0)