From e3ff5b4e3f0f12902cbf1320b03900d495b90da5 Mon Sep 17 00:00:00 2001 From: Dan Fornika Date: Wed, 7 Jun 2023 15:27:59 -0700 Subject: [PATCH] Check for None in symlink target (#19) Co-authored-by: Automated Analysis - BCCDC --- auto_fastq_symlink/core.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/auto_fastq_symlink/core.py b/auto_fastq_symlink/core.py index 12eb533..7225785 100644 --- a/auto_fastq_symlink/core.py +++ b/auto_fastq_symlink/core.py @@ -368,6 +368,11 @@ def create_symlinks(config: dict[str, object], symlinks_to_create_by_project_id: symlinks_complete_by_project_id[project_id] = [] for symlink in symlinks: + # Defend against cases where symlink target is None + # See https://github.com/BCCDC-PHL/auto-fastq-symlink/issues/18 + if symlink['target'] is None: + continue + symlink_parent_dir = os.path.join(project_fastq_symlinks_dir, symlink['sequencing_run_id']) if not os.path.exists(symlink_parent_dir):