FileManage 保存文件到本地后,输出文件路径错误问题解决

This commit is contained in:
ktianc 2024-02-19 22:56:52 +08:00
parent 364a5b3491
commit 3f8b0efccc

View File

@ -72,9 +72,10 @@ class FileManage(FileBase):
if not await save_path.parent.exists():
await save_path.parent.mkdir(parents=True, exist_ok=True)
await save_path.write_bytes(await self.file.read())
remote_path = path.replace(STATIC_ROOT, '').replace("\\", '/')
return {
"local_path": f"{STATIC_ROOT}/{self.path}",
"remote_path": f"{STATIC_URL}/{self.path}"
"local_path": path,
"remote_path": f"{STATIC_URL}/{remote_path}"
}
@classmethod