diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py index 265a13f9f5fc..8e303a985200 100644 --- a/klippy/extras/virtual_sdcard.py +++ b/klippy/extras/virtual_sdcard.py @@ -158,13 +158,9 @@ def cmd_M23(self, gcmd): if self.work_timer is not None: raise gcmd.error("SD busy") self._reset_file() - try: - orig = gcmd.get_commandline() - filename = orig[orig.find("M23") + 4:].split()[0].strip() - if '*' in filename: - filename = filename[:filename.find('*')].strip() - except: - raise gcmd.error("Unable to extract filename") + filename = gcmd.get_raw_command_parameters().strip() + if '*' in filename: + filename = filename[:filename.find('*')].strip() if filename.startswith('/'): filename = filename[1:] self._load_file(gcmd, filename)