From df6e94f7a3b711f08dbb35358422482e6be248db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 28 Mar 2019 20:21:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Better=20validation=20of=20`tool?= =?UTF-8?q?`=20parameter=20on=20/api/printer/tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #3092 --- src/octoprint/server/api/printer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/server/api/printer.py b/src/octoprint/server/api/printer.py index 69f15fb0c..39cb89fc2 100644 --- a/src/octoprint/server/api/printer.py +++ b/src/octoprint/server/api/printer.py @@ -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)