From 3f8b0efccc3aefab072830eeee7d0fbc6cfccb7c Mon Sep 17 00:00:00 2001 From: ktianc Date: Mon, 19 Feb 2024 22:56:52 +0800 Subject: [PATCH] =?UTF-8?q?FileManage=20=E4=BF=9D=E5=AD=98=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=B0=E6=9C=AC=E5=9C=B0=E5=90=8E=EF=BC=8C=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kinit-api/utils/file/file_manage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kinit-api/utils/file/file_manage.py b/kinit-api/utils/file/file_manage.py index 2060284..9d537b8 100644 --- a/kinit-api/utils/file/file_manage.py +++ b/kinit-api/utils/file/file_manage.py @@ -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