You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: move server name pattern validation to code for better error messages
- Add regex validation in parseServerName with specific error messages
- Validate namespace allows only alphanumeric, dots and hyphens
- Validate name allows only alphanumeric, dots, underscores and hyphens
- Update tests to expect descriptive error messages
- Add tests for invalid character validation
- Fix test server names to use valid format
As suggested by @joelverhagen in PR feedback
return"", fmt.Errorf("server namespace '%s' contains invalid characters: only alphanumeric characters, dots (.) and hyphens (-) are allowed", parts[0])
423
+
}
424
+
425
+
if!namePattern.MatchString(parts[1]) {
426
+
return"", fmt.Errorf("server name '%s' contains invalid characters: only alphanumeric characters, dots (.), underscores (_) and hyphens (-) are allowed", parts[1])
0 commit comments