mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-14 03:01:15 +00:00
Append param to query or hash of callback_url.
This commit is contained in:
parent
308fb19da4
commit
5c0cc8a947
@ -1630,6 +1630,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passport_error_too_large" = "This file is too large.";
|
||||
"lng_passport_error_bad_size" = "This image has bad dimensions.";
|
||||
"lng_passport_error_cant_read" = "Can't read this file. Please choose an image.";
|
||||
"lng_passport_bad_name" = "Use latin characters only.";
|
||||
|
||||
// Wnd specific
|
||||
|
||||
|
@ -44,16 +44,15 @@ bool is_ipv6(const QString &ip) {
|
||||
return ip.indexOf('.') < 0 && ip.indexOf(':') >= 0;
|
||||
}
|
||||
|
||||
QString url_append_query(const QString &url, const QString &add) {
|
||||
const auto query = ranges::find(url, '?');
|
||||
const auto hash = ranges::find(url, '#');
|
||||
const auto base = url.mid(0, hash - url.begin());
|
||||
const auto added = base
|
||||
+ (hash <= query ? '?' : '&')
|
||||
QString url_append_query_or_hash(const QString &url, const QString &add) {
|
||||
const auto query = url.lastIndexOf('?');
|
||||
if (query < 0) {
|
||||
return url + '?' + add;
|
||||
}
|
||||
const auto hash = url.lastIndexOf('#');
|
||||
return url
|
||||
+ (query >= 0 && query > url.lastIndexOf('#') ? '&' : '?')
|
||||
+ add;
|
||||
const auto result = added
|
||||
+ (hash < url.end() ? url.mid(hash - url.begin()) : QString());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace qthelp
|
||||
|
@ -26,7 +26,7 @@ QMap<QString, QString> url_parse_params(
|
||||
const QString ¶ms,
|
||||
UrlParamNameTransform transform = UrlParamNameTransform::NoTransform);
|
||||
|
||||
QString url_append_query(const QString &url, const QString &add);
|
||||
QString url_append_query_or_hash(const QString &url, const QString &add);
|
||||
|
||||
bool is_ipv6(const QString &ip);
|
||||
|
||||
|
@ -2099,7 +2099,7 @@ void FormController::cancelSure() {
|
||||
if (!_request.callbackUrl.isEmpty()
|
||||
&& (_serviceErrorText.isEmpty()
|
||||
|| ForwardServiceErrorRequired(_serviceErrorText))) {
|
||||
const auto url = qthelp::url_append_query(
|
||||
const auto url = qthelp::url_append_query_or_hash(
|
||||
_request.callbackUrl,
|
||||
(_submitSuccess
|
||||
? "tg_passport=success"
|
||||
|
@ -68,7 +68,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||
} else if (!QRegularExpression(
|
||||
"^[a-zA-Z\\- ]+$"
|
||||
).match(value).hasMatch()) {
|
||||
return "Use latin characters only.";// lang(lng_passport_bad_name);
|
||||
return lang(lng_passport_bad_name);
|
||||
}
|
||||
return base::none;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user