fix: some error
This commit is contained in:
+4
-9
@@ -27,14 +27,6 @@ from fastapi.responses import FileResponse
|
||||
|
||||
|
||||
class FileStorageInterface:
|
||||
_instance: Optional["FileStorageInterface"] = None
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if cls._instance is None:
|
||||
cls._instance = super(FileStorageInterface, cls).__new__(
|
||||
cls, *args, **kwargs
|
||||
)
|
||||
return cls._instance
|
||||
|
||||
async def save_file(self, file: UploadFile, save_path: str):
|
||||
"""
|
||||
@@ -191,7 +183,10 @@ class SystemFileStorage(FileStorageInterface):
|
||||
"""
|
||||
chunk_dir = (self.root_path / save_path).parent / 'chunks'
|
||||
if chunk_dir.exists():
|
||||
shutil.rmtree(chunk_dir)
|
||||
try:
|
||||
shutil.rmtree(chunk_dir)
|
||||
except Exception as e:
|
||||
logger.info(f"清理本地分片目录失败: {e}")
|
||||
|
||||
|
||||
class S3FileStorage(FileStorageInterface):
|
||||
|
||||
Reference in New Issue
Block a user