This commit is contained in:
jxxghp
2024-11-16 09:25:46 +08:00
parent af3a50f7ea
commit f6a2efb256
8 changed files with 31 additions and 27 deletions

View File

@@ -260,7 +260,7 @@ class Rclone(StorageBase):
logger.error(f"rclone复制文件失败{err}")
return None
def upload(self, fileitem: schemas.FileItem, path: Path) -> Optional[schemas.FileItem]:
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: str = None) -> Optional[schemas.FileItem]:
"""
上传文件
"""
@@ -269,7 +269,7 @@ class Rclone(StorageBase):
[
'rclone', 'copyto',
str(path),
f'MP:{Path(fileitem.path) / path.name}'
f'MP:{Path(fileitem.path) / (new_name or path.name)}'
],
startupinfo=self.__get_hidden_shell()
).returncode