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

Merge pull request !10 from ktianc/master
This commit is contained in:
ktianc 2024-02-19 14:58:18 +00:00 committed by Gitee
commit aca6c3d4f9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

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