octoprint_compat: validate web_request args

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan committed 2023-02-24 10:26:16 -05:00
1 parent 6a5a5b50d3
commit fd5ea0c6a4
1 file changed
+3 -3
+3 -3
View File
@@ -355,12 +355,12 @@ class OctoPrintCompat:
async def _select_file(self,
web_request: WebRequest
) -> None:
command: str = web_request.get('command')
rel_path: str = web_request.get('relative_path')
command: str = web_request.get_str('command')
rel_path: str = web_request.get_str('relative_path')
root, filename = rel_path.strip("/").split("/", 1)
fmgr: FileManager = self.server.lookup_component('file_manager')
if command == "select":
start_print: bool = web_request.get('print', False)
start_print: bool = web_request.get_boolean('print', False)
if not start_print:
# No-op, selecting a file has no meaning in Moonraker
return