@@ -57,7 +57,8 @@ def suggest_path(
5757 )
5858
5959 # Construct the full path to where the dataset is to be saved
60- check_path = machine_config .rsync_basepath / base_path
60+ rsync_basepath = (machine_config .rsync_basepath or Path ("" )).resolve ()
61+ check_path = rsync_basepath / base_path
6162
6263 # Check previous year to account for the year rolling over during data collection
6364 if not check_path .parent .exists ():
@@ -69,7 +70,7 @@ def suggest_path(
6970 base_path_parts [year_idx ] = str (int (part ) - 1 )
7071 base_path = "/" .join (base_path_parts )
7172 check_path_prev = check_path
72- check_path = machine_config . rsync_basepath / base_path
73+ check_path = rsync_basepath / base_path
7374
7475 # If it's not in the previous year either, it's a genuine error
7576 if not check_path .parent .exists ():
@@ -88,7 +89,7 @@ def suggest_path(
8889 check_path .mkdir (mode = 0o750 )
8990 if params .extra_directory :
9091 (check_path / secure_filename (params .extra_directory )).mkdir (mode = 0o750 )
91- return {"suggested_path" : check_path .relative_to (machine_config . rsync_basepath )}
92+ return {"suggested_path" : check_path .relative_to (rsync_basepath )}
9293
9394
9495class Dest (BaseModel ):
@@ -107,7 +108,9 @@ def make_rsyncer_destination(session_id: int, destination: Dest, db=murfey_db):
107108 ]
108109 if not machine_config :
109110 raise ValueError ("No machine configuration set when making rsyncer destination" )
110- full_destination_path = machine_config .rsync_basepath / destination_path
111+ full_destination_path = (
112+ machine_config .rsync_basepath or Path ("" )
113+ ).resolve () / destination_path
111114 for parent_path in full_destination_path .parents :
112115 parent_path .mkdir (mode = 0o750 , exist_ok = True )
113116 return destination
@@ -151,7 +154,7 @@ async def write_eer_fractionation_file(
151154 ) / secure_filename (fractionation_params .fractionation_file_name )
152155 else :
153156 file_path = (
154- Path (machine_config .rsync_basepath )
157+ (machine_config .rsync_basepath or Path ( "" )). resolve ( )
155158 / str (datetime .now ().year )
156159 / secure_filename (visit_name )
157160 / machine_config .gain_directory_name
0 commit comments