From 3441431cdf64a4d95ee0deca79e84b73513a37b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 6 Jul 2015 10:49:13 +0200 Subject: [PATCH] Do only allow machinecode files for selection/printing --- CHANGELOG.md | 5 +++++ src/octoprint/server/api/files.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3fe94d..c29c2489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ Will now log the update commands and their output similar to the Plugin Manager install and uninstall dialog. +### Bug Fixes + +* It's not possible anymore to select files that are not machinecode files (e.g. + GCODE) for printing on the file API. + ## 1.2.2 (2015-06-30) ### Bug Fixes diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 9c318a6b..5edb1dab 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -292,6 +292,9 @@ def gcodeFileCommand(filename, target): if command == "select": # selects/loads a file + if not octoprint.filemanager.valid_file_type(filename, type="machinecode"): + return make_response("Cannot select {filename} for printing, not a machinecode file".format(**locals()), 415) + printAfterLoading = False if "print" in data.keys() and data["print"] in valid_boolean_trues: if not printer.is_operational():