File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -237,9 +237,9 @@ def get_possible_gain_references(
237237 headers = {"Authorization" : f"Bearer { tokens [session_id ]} " },
238238 ).json ()
239239 candidates = []
240- for gf in secure_path (Path ( machine_config [ "gain_reference_directory" ])). glob (
241- "**/*"
242- ):
240+ for gf in secure_path (
241+ Path ( machine_config [ "gain_reference_directory" ]), keep_spaces = True
242+ ). glob ( "**/*" ) :
243243 if gf .is_file ():
244244 candidates .append (
245245 File (
Original file line number Diff line number Diff line change @@ -62,8 +62,11 @@ def sanitise_nonpath(in_string: str) -> str:
6262 return in_string
6363
6464
65- def secure_path (in_path : Path ) -> Path :
66- secured_parts = [secure_filename (p ) for p in in_path .parts ]
65+ def secure_path (in_path : Path , keep_spaces : bool = False ) -> Path :
66+ if keep_spaces :
67+ secured_parts = [secure_filename (p ) for p in in_path .parts if " " not in p ]
68+ else :
69+ secured_parts = [secure_filename (p ) for p in in_path .parts ]
6770 return Path ("/" .join (secured_parts ))
6871
6972
You can’t perform that action at this time.
0 commit comments