Add \n if not present in web commands

This commit is contained in:
Luc 2020-05-11 10:13:50 +02:00
parent fd9322aca9
commit 4aa503741f
2 changed files with 2 additions and 1 deletions

View File

@ -22,7 +22,7 @@
#define _VERSION_ESP3D_H #define _VERSION_ESP3D_H
//version and sources location //version and sources location
#define FW_VERSION "3.0.0.a35" #define FW_VERSION "3.0.0.a36"
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0" #define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
#endif //_VERSION_ESP3D_H #endif //_VERSION_ESP3D_H

View File

@ -39,6 +39,7 @@ void HTTP_Server::handle_web_command ()
if (_webserver->hasArg ("cmd")) { if (_webserver->hasArg ("cmd")) {
cmd = _webserver->arg ("cmd"); cmd = _webserver->arg ("cmd");
ESP3DOutput output(_webserver); ESP3DOutput output(_webserver);
if(!cmd.endsWith("\n")) cmd+="\n";//need to validate command
esp3d_commands.process((uint8_t*)cmd.c_str(), cmd.length(), &output, auth_level); esp3d_commands.process((uint8_t*)cmd.c_str(), cmd.length(), &output, auth_level);
} else { } else {
_webserver->send (400, "text/plain", "Invalid command"); _webserver->send (400, "text/plain", "Invalid command");