extract_metadata: don't remove ufp files after failed extraction
Cura writes ufp files in chunks, closing the file after each chunk is written. This will result in a failed extraction, and removing the file will result in corruption. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
9e909e8532
commit
d3df568aec
|
@ -704,11 +704,13 @@ def extract_ufp(ufp_path: str, dest_path: str) -> None:
|
|||
if not os.path.exists(dest_thumb_dir):
|
||||
os.mkdir(dest_thumb_dir)
|
||||
shutil.move(tmp_thumb_path, dest_thumb_path)
|
||||
finally:
|
||||
try:
|
||||
os.remove(ufp_path)
|
||||
except Exception:
|
||||
log_to_stderr(f"Error removing ufp file: {ufp_path}")
|
||||
except Exception:
|
||||
log_to_stderr(traceback.format_exc())
|
||||
sys.exit(-1)
|
||||
try:
|
||||
os.remove(ufp_path)
|
||||
except Exception:
|
||||
log_to_stderr(f"Error removing ufp file: {ufp_path}")
|
||||
|
||||
def main(path: str, filename: str, ufp: Optional[str]) -> None:
|
||||
file_path = os.path.join(path, filename)
|
||||
|
|
Loading…
Reference in New Issue