Fix unknown command handler for filenames containing spaces

Pass the original string to the unknown command callback instead of the parsed command, as the latter ends at the first whitespace, which breaks for unknown commands (filenames) containing spaces.

Closes #5902.
This commit is contained in:
Robert Müller 2022-10-01 20:10:59 +02:00
parent 7f8408eebc
commit 9d1f393c55

View file

@ -548,7 +548,9 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, bo
}
else if(Stroke)
{
if(!m_pfnUnknownCommandCallback(Result.m_pCommand, m_pUnknownCommandUserdata))
// Pass the original string to the unknown command callback instead of the parsed command, as the latter
// ends at the first whitespace, which breaks for unknown commands (filenames) containing spaces.
if(!m_pfnUnknownCommandCallback(pStr, m_pUnknownCommandUserdata))
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "No such command: %s.", Result.m_pCommand);