File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -557,10 +557,22 @@ def _generate_dataset_info(
557557 ignored_files = []
558558
559559 for dataset_path in datasets :
560- # Create relative path from base directory
560+ # Create relative path from the datasets directory
561561 try :
562- relative_path = dataset_path .relative_to (base_path .parent )
563- web_path = f"/datasets/{ relative_path .as_posix ()} "
562+ # Find the datasets root by looking for "datasets" in the path
563+ datasets_root = None
564+ for parent in dataset_path .parents :
565+ if parent .name == "datasets" :
566+ datasets_root = parent
567+ break
568+
569+ if datasets_root :
570+ relative_path = dataset_path .relative_to (datasets_root )
571+ web_path = f"/datasets/{ relative_path .as_posix ()} "
572+ else :
573+ # If no datasets parent found, try the original base_path
574+ relative_path = dataset_path .relative_to (self .base_path )
575+ web_path = f"/datasets/{ relative_path .as_posix ()} "
564576 except ValueError :
565577 # Fallback if relative path fails
566578 web_path = f"/datasets/{ dataset_path .name } "
You can’t perform that action at this time.
0 commit comments