#14481·hyperswitch

bug: lone plus is accepted as a phone country code

Author: Vaishnavi220506Created Sep 29, 2026Updated Sep 29, 2026

Bug

validate_phone_country_code("+") returns Ok(()). The validator accepts an optional leading +, but it does not require a digit after stripping that prefix. Customer create and update requests both use this validator for phone_country_code.

Reproduction

On main at 31a11a8, the following assertion fails:

rust
assert!(validate_phone_country_code("+").is_err());

The input should be rejected as an invalid country calling code. Numeric values such as "+1" and "91" should remain accepted.