Skip to content

Commit

Permalink
Sanitize study.name
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m committed Sep 20, 2023
1 parent a5db736 commit f217538
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/finch_tracker/tracker_lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ export function serializeStudies(
};

for (const study of seed.study) {
const name = study.name;
const sanitizedName = path
.normalize(study.name)
.replace(/^(\.\.(\/|\\|$))+/, '');
const processed = new ProcessedStudy(study, options);
processed.postProcessBeforeSerialization();
addStudy(path.join('all-by-name', name), study);
addStudy(path.join('all-by-name', sanitizedName), study);
if (!processed.studyDetails.isOutdated()) {
const priority = processed.getPriority();
if (priority > StudyPriority.NON_INTERESTING)
addStudy(path.join(priorityToText(priority), name), study);
addStudy(path.join(priorityToText(priority), sanitizedName), study);
}
}
return map;
Expand Down

0 comments on commit f217538

Please sign in to comment.