Skip to content

Commit d85d913

Browse files
committed
Removed checks from 'validate_and_sanitise' functions for whether a Path object is a file
1 parent 2d2eb40 commit d85d913

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

src/murfey/server/api/clem.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,6 @@ def validate_and_sanitise(
9494
if not str(full_path).startswith(str(base_path)):
9595
raise ValueError(f"{file} points to a directory that is not permitted")
9696

97-
# # Check that it's a file, not a directory
98-
# # Make a couple of attempts to rule out race condition
99-
# attempts = 0
100-
# while attempts < 50:
101-
# if full_path.is_file() is True:
102-
# break
103-
# attempts += 1
104-
# time.sleep(0.1)
105-
# else:
106-
# raise ValueError(f"{file} is not a file")
107-
10897
# Check that it is of a permitted file type
10998
if f"{full_path.suffix}" not in valid_file_types:
11099
raise ValueError(f"{full_path.suffix} is not a permitted file format")

src/murfey/workflows/clem/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
import re
5-
import time
65
from pathlib import Path
76
from typing import Optional, Type, Union
87

@@ -90,17 +89,6 @@ def _validate_and_sanitise(
9089
if not str(full_path).startswith(str(base_path)):
9190
raise ValueError(f"{file} points to a directory that is not permitted")
9291

93-
# Check that it's a file, not a directory
94-
# Make a couple of attempts to rule out race condition
95-
attempts = 0
96-
while attempts < 50:
97-
if full_path.is_file() is True:
98-
break
99-
attempts += 1
100-
time.sleep(0.1)
101-
else:
102-
raise ValueError(f"{file} is not a file")
103-
10492
# Check that it is of a permitted file type
10593
if f"{full_path.suffix}" not in valid_file_types:
10694
raise ValueError(f"{full_path.suffix} is not a permitted file format")

0 commit comments

Comments
 (0)