From 893e14cc395d6358be84889eefe00fa506e7ef26 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 8 Jan 2024 17:34:08 +0400 Subject: [PATCH] Fix payment field values formatting. Regression was introduced in e6b9a07163. Fixes #27318. --- Telegram/SourceFiles/payments/ui/payments_field.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/payments/ui/payments_field.cpp b/Telegram/SourceFiles/payments/ui/payments_field.cpp index e182714e3..1314674ce 100644 --- a/Telegram/SourceFiles/payments/ui/payments_field.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_field.cpp @@ -217,10 +217,10 @@ struct SimpleFieldState { const FieldConfig &config, const QString &parsed, const QString &countryIso2) { - static const auto RegExp = QRegularExpression("[^0-9]\\."); if (config.type == FieldType::Country) { return countryIso2; } else if (config.type == FieldType::Money) { + static const auto RegExp = QRegularExpression("[^0-9\\.]"); const auto rule = LookupCurrencyRule(config.currency); const auto real = QString(parsed).replace( QChar(rule.decimal), @@ -236,6 +236,7 @@ struct SimpleFieldState { int64(base::SafeRound(real * std::pow(10., rule.exponent)))); } else if (config.type == FieldType::CardNumber || config.type == FieldType::CardCVC) { + static const auto RegExp = QRegularExpression("[^0-9]"); return QString(parsed).replace(RegExp, QString()); } return parsed;