From 0ff4218ac5b02d5ae646817900156f55ffd874e4 Mon Sep 17 00:00:00 2001 From: Kay Cha Date: Fri, 26 Apr 2024 21:41:57 +0900 Subject: [PATCH] Replaced naming filename for FileSystemStorage (#49) --- fastapi_storages/filesystem.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastapi_storages/filesystem.py b/fastapi_storages/filesystem.py index 946e1dc..868f6b9 100644 --- a/fastapi_storages/filesystem.py +++ b/fastapi_storages/filesystem.py @@ -43,7 +43,7 @@ def open(self, name: str) -> BinaryIO: Open a file handle of the file object in binary mode. """ - path = self._path / Path(name) + path = self.get_path(name) return open(path, "rb") def write(self, file: BinaryIO, name: str) -> str: @@ -51,8 +51,8 @@ def write(self, file: BinaryIO, name: str) -> str: Write input file which is opened in binary mode to destination. """ - filename = secure_filename(name) - path = self._path / Path(filename) + filename = self.get_name(name) + path = self.get_path(filename) file.seek(0, 0) with open(path, "wb") as output: