diff --git a/modules/untar/main.nf b/modules/untar/main.nf index 007871b3..71eea7b2 100644 --- a/modules/untar/main.nf +++ b/modules/untar/main.nf @@ -27,7 +27,7 @@ process UNTAR { ## Ensures --strip-components only applied when top level of tar contents is a directory ## If just files or multiple directories, place all in output - if [[ \$(tar -tzf ${archive} | grep "/\$" | wc -l) -eq 1 ]]; then + if [[ \$(tar -tzf ${archive} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then tar \\ -C output --strip-components 1 \\ -xzvf \\ diff --git a/tests/modules/untar/test.yml b/tests/modules/untar/test.yml index 4e39e762..8ebb2d12 100644 --- a/tests/modules/untar/test.yml +++ b/tests/modules/untar/test.yml @@ -15,7 +15,7 @@ tags: - untar files: - - path: output/untar/flowcell/220422_M11111_0222_000000000-K9H97/RunInfo.xml + - path: output/untar/flowcell/RunInfo.xml md5sum: 03038959f4dd181c86bc97ae71fe270a - name: untar test_untar_onlyfiles