🐛 Better validation of tool parameter on /api/printer/tool

Fixes #3092
This commit is contained in:
Gina Häußge committed 2019-03-28 20:21:44 +01:00
1 parent 1a2739c640
commit df6e94f7a3
1 file changed
+1 -1
+1 -1
View File
@@ -86,7 +86,7 @@ def printerToolCommand():
##~~ tool selection
if command == "select":
tool = data["tool"]
if re.match(validation_regex, tool) is None:
if not isinstance(tool, basestring) or re.match(validation_regex, tool) is None:
return make_response("Invalid tool: %s" % tool, 400)
if not tool.startswith("tool"):
return make_response("Invalid tool for selection: %s" % tool, 400)