This commit is contained in:
jxxghp
2024-11-17 14:03:03 +08:00
parent abebae3664
commit 8dc9acf071
4 changed files with 53 additions and 33 deletions
+3 -2
View File
@@ -265,16 +265,17 @@ class Rclone(StorageBase):
上传文件
"""
try:
new_path = Path(fileitem.path) / (new_name or path.name)
retcode = subprocess.run(
[
'rclone', 'copyto',
str(path),
f'MP:{Path(fileitem.path) / (new_name or path.name)}'
f'MP:{new_path}'
],
startupinfo=self.__get_hidden_shell()
).returncode
if retcode == 0:
return self.__get_fileitem(path)
return self.__get_fileitem(new_path)
except Exception as err:
logger.error(f"rclone上传文件失败:{err}")
return None