Browse Source

Fixed bug where print cover could not be fetched in Docker environments

maziggy 4 months ago
parent
commit
ffd0c8bddf
1 changed files with 3 additions and 0 deletions
  1. 3 0
      backend/app/services/bambu_ftp.py

+ 3 - 0
backend/app/services/bambu_ftp.py

@@ -1,5 +1,6 @@
 import asyncio
 import logging
+import os
 import socket
 import ssl
 from collections.abc import Callable
@@ -170,6 +171,8 @@ class BambuFTPClient:
             local_path.parent.mkdir(parents=True, exist_ok=True)
             with open(local_path, "wb") as f:
                 self._ftp.retrbinary(f"RETR {remote_path}", f.write)
+                f.flush()
+                os.fsync(f.fileno())
             file_size = local_path.stat().st_size if local_path.exists() else 0
             logger.info(f"Successfully downloaded {remote_path} to {local_path} ({file_size} bytes)")
             return True