diff --git a/scan-batch-dir b/scan-batch-dir index d212480..db646c4 100755 --- a/scan-batch-dir +++ b/scan-batch-dir @@ -555,10 +555,7 @@ def process_tiff(file_path:str, level): # Create the JP2 derivative if it does not already exist. # if the JP2 does not exist: jp2_path = f"{dir}/{pid}.jp2" - if level == 1: - out_pid = f"{pid}" - else: - out_pid = f"{parent}-{pid}" + out_pid = f"{pid}" logger.info(f"Tiff: Creating JP2: {jp2_path}") if not os.path.exists(jp2_path): @@ -954,11 +951,11 @@ def process_file(df: pd.DataFrame, file_path: str, level): imodel, field_model, resource_type = get_model_details(level) # Handle top level files by adjusting the PID and parent_folder. - if not level == 1: - # Not in top level folder. - pid = f"{parent_folder}-{file_name}" - else: - pid = f"{file_name}" + # The file's own name is always the PID; the parent object's PID + # is tracked separately via parent_id — it should never be + # concatenated onto the file's PID. + pid = f"{file_name}" + if level == 1: parent_folder = '' # Default row_data