From 30a523b8c16de7e52ff97972117162ec77958d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 24 Apr 2018 16:00:09 +0200 Subject: [PATCH] Fix printer.select_file * properly handle relative paths for selection * properly handle absolute paths for recovery data comparison Fixes #2601 --- src/octoprint/printer/standard.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 9758df302..0401bb9a3 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -425,19 +425,22 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self._validateJob(path, sd) + origin = FileDestinations.SDCARD if sd else FileDestinations.LOCAL + path_on_disk = self._fileManager.path_on_disk(origin, path) + path_in_storage = self._fileManager.path_in_storage(origin, path_on_disk) + recovery_data = self._fileManager.get_recovery_data() if recovery_data: # clean up recovery data if we just selected a different file than is logged in that - expected_origin = FileDestinations.SDCARD if sd else FileDestinations.LOCAL actual_origin = recovery_data.get("origin", None) actual_path = recovery_data.get("path", None) - if actual_origin is None or actual_path is None or actual_origin != expected_origin or actual_path != path: + if actual_origin is None or actual_path is None or actual_origin != origin or actual_path != path_in_storage: self._fileManager.delete_recovery_data() self._printAfterSelect = printAfterSelect self._posAfterSelect = pos - self._comm.selectFile("/" + path if sd else path, sd, + self._comm.selectFile("/" + path if sd else path_on_disk, sd, tags=kwargs.get("tags", set()) | {"trigger:printer.select_file"}) self._updateProgressData() self._setCurrentZ(None)