Skip to content

Commit 7a84574

Browse files
committed
Fix race condition in create_directory_if_needed
1 parent d866388 commit 7a84574

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

approval_utilities/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def ensure_file_exists(approved_path: str) -> None:
6565

6666
def create_directory_if_needed(received_file: str) -> None:
6767
directory = os.path.dirname(received_file)
68-
if directory and not os.path.exists(directory):
69-
os.makedirs(directory)
68+
if directory:
69+
os.makedirs(directory, exist_ok=True)
7070

7171

7272
def print_grid(width, height, cell_print_func):

0 commit comments

Comments
 (0)