Remove superflous emptiness checks in get_url_query_hash/slug.

This commit is contained in:
levlam 2023-03-30 21:12:54 +03:00
parent 02a2e23cac
commit ced48b910f

View File

@ -70,12 +70,12 @@ static bool is_valid_web_app_name(Slice name) {
static string get_url_query_hash(bool is_tg, const HttpUrlQuery &url_query) { static string get_url_query_hash(bool is_tg, const HttpUrlQuery &url_query) {
const auto &path = url_query.path_; const auto &path = url_query.path_;
if (is_tg) { if (is_tg) {
if (path.size() == 1 && path[0] == "join" && !url_query.get_arg("invite").empty()) { if (path.size() == 1 && path[0] == "join") {
// join?invite=<hash> // join?invite=<hash>
return url_query.get_arg("invite").str(); return url_query.get_arg("invite").str();
} }
} else { } else {
if (path.size() >= 2 && path[0] == "joinchat" && !path[1].empty()) { if (path.size() >= 2 && path[0] == "joinchat") {
// /joinchat/<hash> // /joinchat/<hash>
return path[1]; return path[1];
} }
@ -90,12 +90,12 @@ static string get_url_query_hash(bool is_tg, const HttpUrlQuery &url_query) {
static string get_url_query_slug(bool is_tg, const HttpUrlQuery &url_query) { static string get_url_query_slug(bool is_tg, const HttpUrlQuery &url_query) {
const auto &path = url_query.path_; const auto &path = url_query.path_;
if (is_tg) { if (is_tg) {
if (path.size() == 1 && path[0] == "list" && !url_query.get_arg("slug").empty()) { if (path.size() == 1 && path[0] == "list") {
// list?slug=<hash> // list?slug=<hash>
return url_query.get_arg("slug").str(); return url_query.get_arg("slug").str();
} }
} else { } else {
if (path.size() >= 2 && path[0] == "list" && !path[1].empty()) { if (path.size() >= 2 && path[0] == "list") {
// /list/<hash> // /list/<hash>
return path[1]; return path[1];
} }