gcode_macro: Disallow whitespace in macro name (#4312)

Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
This commit is contained in:
Florian Heilmann 2021-05-26 19:03:10 +02:00 committed by GitHub
parent bd42d497ae
commit ba3bbca861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -113,6 +113,10 @@ def load_config(config):
class GCodeMacro: class GCodeMacro:
def __init__(self, config): def __init__(self, config):
if len(config.get_name().split()) > 2:
raise config.error(
"Name of section '%s' contains illegal whitespace"
% (config.get_name()))
name = config.get_name().split()[1] name = config.get_name().split()[1]
self.alias = name.upper() self.alias = name.upper()
self.printer = printer = config.get_printer() self.printer = printer = config.get_printer()