File tree Expand file tree Collapse file tree 2 files changed +0
-23
lines changed
Expand file tree Collapse file tree 2 files changed +0
-23
lines changed Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff line change 22
33import logging
44import re
5- import time
65from pathlib import Path
76from 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" )
You can’t perform that action at this time.
0 commit comments