virtual_sdcard: Allow spaces in file path for M23

Also makes M23 work normally with rename_existing.

Signed-off-by: Justin Schuh <code@justinschuh.com>
This commit is contained in:
Justin Schuh 2022-03-01 15:58:59 -08:00 committed by KevinOConnor
parent b4b19b8fc1
commit 1390b4d600
1 changed files with 1 additions and 7 deletions

View File

@ -158,13 +158,7 @@ class VirtualSD:
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 filename.startswith('/'):
filename = filename[1:]
self._load_file(gcmd, filename)