Skip to content

Commit

Permalink
fixed the creation of the directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Tansito committed Dec 26, 2024
1 parent d426ec4 commit f51f345
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gateway/api/services/file_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def __get_user_path(self, function_title: str, provider_name: str | None) -> str
sanitized_path = sanitize_file_path(path)

# Create directory if it doesn't exist
os.makedirs(os.path.dirname(sanitized_path), exist_ok=True)
if not os.path.exists(sanitized_path):
os.makedirs(sanitized_path, exist_ok=True)
logger.debug("Path %s was created.", sanitized_path)

return sanitized_path

Expand All @@ -107,7 +109,9 @@ def __get_provider_path(self, function_title: str, provider_name: str) -> str:
sanitized_path = sanitize_file_path(path)

# Create directory if it doesn't exist
os.makedirs(os.path.dirname(sanitized_path), exist_ok=True)
if not os.path.exists(sanitized_path):
os.makedirs(sanitized_path, exist_ok=True)
logger.debug("Path %s was created.", sanitized_path)

return sanitized_path

Expand Down

0 comments on commit f51f345

Please sign in to comment.