Fix a typo from 2000 BC

This commit is contained in:
Louvenarde 2024-02-03 17:11:23 +01:00
parent 14b52dbb51
commit 0218ff618c
2 changed files with 2 additions and 9 deletions

View File

@ -623,17 +623,10 @@ namespace Components
std::hash<ServerInfo> hashFn;
server.hash = hashFn(server);
#if false
// more secure
server.hostname = TextRenderer::StripMaterialTextIcons(server.hostname);
#else
// more fun !
constexpr auto MAX_SERVER_NAME_LENGTH = 48;
server.hostname = server.hostname.substr(0, MAX_SERVER_NAME_LENGTH);
#endif
const auto strippedHostName = TextRenderer::StripMaterialTextIcons(server.hostname);
if (server.hostname.empty() || strippedHostName.empty() || std::all_of(strippedHostName.begin(), strippedHostName.end(), isspace))
if (server.hostname.empty() || std::all_of(server.hostname.begin(), server.hostname.end(), isspace))
{
// Invalid server name containing only emojis
return;

View File

@ -1414,7 +1414,7 @@ namespace Components
std::string TextRenderer::StripMaterialTextIcons(const std::string& in)
{
char buffer[1000]{}; // Should be more than enough
StripAllTextIcons(in.data(), buffer, sizeof(buffer));
StripMaterialTextIcons(in.data(), buffer, sizeof(buffer));
return std::string{ buffer };
}