Skip to content

Commit 9f108d5

Browse files
author
Patrick Bareiss
committed
search_activity.log
1 parent 8b9591e commit 9f108d5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

bin/dataset_analyzer.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff 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}"

0 commit comments

Comments
 (0)