Improve clean_filename behavior.
GitOrigin-RevId: da29b1a87a27b6bcb7651ae1b261d44dcf18849f
This commit is contained in:
parent
3e89fac991
commit
7d565e359d
@ -6765,7 +6765,8 @@ void ContactsManager::on_update_user_online(UserId user_id, tl_object_ptr<telegr
|
|||||||
on_update_user_online(u, user_id, std::move(status));
|
on_update_user_online(u, user_id, std::move(status));
|
||||||
update_user(u, user_id);
|
update_user(u, user_id);
|
||||||
|
|
||||||
if (user_id == get_my_id() && was_online_remote_ != u->was_online) { // only update was_online_remote_ from updateUserStatus
|
if (user_id == get_my_id() &&
|
||||||
|
was_online_remote_ != u->was_online) { // only update was_online_remote_ from updateUserStatus
|
||||||
was_online_remote_ = u->was_online;
|
was_online_remote_ = u->was_online;
|
||||||
VLOG(notifications) << "Set was_online_remote to " << was_online_remote_;
|
VLOG(notifications) << "Set was_online_remote to " << was_online_remote_;
|
||||||
G()->td_db()->get_binlog_pmc()->set("my_was_online_remote", to_string(was_online_remote_));
|
G()->td_db()->get_binlog_pmc()->set("my_was_online_remote", to_string(was_online_remote_));
|
||||||
|
@ -84,6 +84,9 @@ static std::string clean_filename_part(Slice name, int max_length) {
|
|||||||
uint32 code;
|
uint32 code;
|
||||||
it = next_utf8_unsafe(it, &code, "clean_filename_part");
|
it = next_utf8_unsafe(it, &code, "clean_filename_part");
|
||||||
if (!is_ok(code)) {
|
if (!is_ok(code)) {
|
||||||
|
if (prepare_search_character(code) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
code = ' ';
|
code = ' ';
|
||||||
}
|
}
|
||||||
if (new_name.empty() && (code == ' ' || code == '.')) {
|
if (new_name.empty() && (code == ' ' || code == '.')) {
|
||||||
|
@ -38,4 +38,5 @@ TEST(Misc, clean_filename) {
|
|||||||
ASSERT_STREQ(clean_filename("test.exe01234567890123456789...."),
|
ASSERT_STREQ(clean_filename("test.exe01234567890123456789...."),
|
||||||
"test.exe01234567890123456789"); // extension may be more then 20 characters
|
"test.exe01234567890123456789"); // extension may be more then 20 characters
|
||||||
ASSERT_STREQ(clean_filename("....test....asdf"), "test.asdf");
|
ASSERT_STREQ(clean_filename("....test....asdf"), "test.asdf");
|
||||||
|
ASSERT_STREQ(clean_filename("കറുപ്പ്.txt"), "കറപപ.txt");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user