diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 12012087..5cd33834 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -248,8 +248,8 @@ def _verifyFolderExists(origin, foldername): def _isBusy(target, path): - currentOrigin, currentFilename = _getCurrentFile() - if currentFilename is not None and currentOrigin == target and fileManager.file_in_path(FileDestinations.LOCAL, path, currentFilename) and (printer.is_printing() or printer.is_paused()): + currentOrigin, currentPath = _getCurrentFile() + if currentPath is not None and currentOrigin == target and fileManager.file_in_path(FileDestinations.LOCAL, path, currentPath) and (printer.is_printing() or printer.is_paused()): return True return any(target == x[0] and fileManager.file_in_path(FileDestinations.LOCAL, path, x[1]) for x in fileManager.get_busy_files()) @@ -705,8 +705,8 @@ def deleteGcodeFile(filename, target): return make_response("Trying to delete a file that is currently in use: %s" % filename, 409) # deselect the file if it's currently selected - currentOrigin, currentFilename = _getCurrentFile() - if currentFilename is not None and currentOrigin == target and filename == currentFilename: + currentOrigin, currentPath = _getCurrentFile() + if currentPath is not None and currentOrigin == target and filename == currentPath: printer.unselect_file() # delete it @@ -723,8 +723,8 @@ def deleteGcodeFile(filename, target): return make_response("Trying to delete a folder that contains a file that is currently in use: %s" % filename, 409) # deselect the file if it's currently selected - currentOrigin, currentFilename = _getCurrentFile() - if currentFilename is not None and currentOrigin == target and fileManager.file_in_path(target, filename, currentFilename): + currentOrigin, currentPath = _getCurrentFile() + if currentPath is not None and currentOrigin == target and fileManager.file_in_path(target, filename, currentPath): printer.unselect_file() # delete it @@ -734,8 +734,8 @@ def deleteGcodeFile(filename, target): def _getCurrentFile(): currentJob = printer.get_current_job() - if currentJob is not None and "file" in currentJob.keys() and "name" in currentJob["file"] and "origin" in currentJob["file"]: - return currentJob["file"]["origin"], currentJob["file"]["name"] + if currentJob is not None and "file" in currentJob.keys() and "path" in currentJob["file"] and "origin" in currentJob["file"]: + return currentJob["file"]["origin"], currentJob["file"]["path"] else: return None, None diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py index d4df75b0..af2f106b 100644 --- a/src/octoprint/server/util/sockjs.py +++ b/src/octoprint/server/util/sockjs.py @@ -154,12 +154,12 @@ class PrinterStateConnection(sockjs.tornado.SockJSConnection, octoprint.printer. messages = self._messageBacklog self._messageBacklog = [] - busy_files = [dict(origin=v[0], name=v[1]) for v in self._fileManager.get_busy_files()] + busy_files = [dict(origin=v[0], path=v[1]) for v in self._fileManager.get_busy_files()] if "job" in data and data["job"] is not None \ - and "file" in data["job"] and "name" in data["job"]["file"] and "origin" in data["job"]["file"] \ - and data["job"]["file"]["name"] is not None and data["job"]["file"]["origin"] is not None \ + and "file" in data["job"] and "path" in data["job"]["file"] and "origin" in data["job"]["file"] \ + and data["job"]["file"]["path"] is not None and data["job"]["file"]["origin"] is not None \ and (self._printer.is_printing() or self._printer.is_paused()): - busy_files.append(dict(origin=data["job"]["file"]["origin"], name=data["job"]["file"]["name"])) + busy_files.append(dict(origin=data["job"]["file"]["origin"], path=data["job"]["file"]["path"])) data.update({ "serverTime": time.time(), diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js index 9a820720..1ccd6b83 100644 --- a/src/octoprint/static/js/app/viewmodels/printerstate.js +++ b/src/octoprint/static/js/app/viewmodels/printerstate.js @@ -256,8 +256,8 @@ $(function() { self._processBusyFiles = function(data) { var busyFiles = []; _.each(data, function(entry) { - if (entry.hasOwnProperty("name") && entry.hasOwnProperty("origin")) { - busyFiles.push(entry.origin + ":" + entry.name); + if (entry.hasOwnProperty("path") && entry.hasOwnProperty("origin")) { + busyFiles.push(entry.origin + ":" + entry.path); } }); self.busyFiles(busyFiles);