diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy index 6c7aed3735..1c4d76b5f2 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy @@ -406,9 +406,10 @@ class PublishDir { // resolve Fusion symlink if applicable if( FusionHelper.isFusionEnabled(session) ) { + final sourceName = sourceDir.relativize(source).toString() final inputs = getTaskInputs() - if( source.name in inputs ) - source = resolveFusionLink(inputs[source.name]) + if( sourceName in inputs ) + source = resolveFusionLink(inputs[sourceName]) } // create target dirs if required diff --git a/plugins/nf-amazon/src/test/nextflow/processor/PublishDirS3Test.groovy b/plugins/nf-amazon/src/test/nextflow/processor/PublishDirS3Test.groovy index 5dd5cdf873..ddc3df4377 100644 --- a/plugins/nf-amazon/src/test/nextflow/processor/PublishDirS3Test.groovy +++ b/plugins/nf-amazon/src/test/nextflow/processor/PublishDirS3Test.groovy @@ -80,12 +80,13 @@ class PublishDirS3Test extends Specification { } and: def prev = FileHelper.asPath('s3://bucket/work/0/foo.txt') - def file = FileHelper.asPath('s3://bucket/work/1/foo.txt') - def taskInputs = ['foo.txt': file] + def sourceDir = FileHelper.asPath('s3://bucket/work/1/') + def file = sourceDir.resolve('bar/foo.txt') + def taskInputs = ['bar/foo.txt': file] and: def targetDir = FileHelper.asPath('s3://bucket/results') - def target = targetDir.resolve('foo.txt') - def publisher = Spy(new PublishDir(path: targetDir)) { getTaskInputs()>>taskInputs } + def target = targetDir.resolve('bar/foo.txt') + def publisher = Spy(new PublishDir(sourceDir: sourceDir, path: targetDir)) { getTaskInputs()>>taskInputs } when: publisher.processFile(file, target)