diff --git a/packages/antora-zip-contents-collector-extension/lib/index.js b/packages/antora-zip-contents-collector-extension/lib/index.js index 4b8183f..3624bb6 100644 --- a/packages/antora-zip-contents-collector-extension/lib/index.js +++ b/packages/antora-zip-contents-collector-extension/lib/index.js @@ -195,7 +195,8 @@ function register ({ config, downloadLog }) { logger.trace(`Skipping local file URL ${url} due to missing worktree`) continue } - return ospath.join(worktree, ...url.split('/')) + const localFile = ospath.join(worktree, ...url.split('/')) + if (fs.existsSync(localFile)) return localFile } } } diff --git a/packages/antora-zip-contents-collector-extension/test/zip-contents-collector-extension-test.js b/packages/antora-zip-contents-collector-extension/test/zip-contents-collector-extension-test.js index 7cfbe1d..2d45086 100644 --- a/packages/antora-zip-contents-collector-extension/test/zip-contents-collector-extension-test.js +++ b/packages/antora-zip-contents-collector-extension/test/zip-contents-collector-extension-test.js @@ -591,7 +591,7 @@ describe('zip contents collector extension', () => { it('should use local zip and collect files', async () => { const extensionConfig = () => ({ - locations: [{ url: 'build/${name}.zip' }, { url: 'build/${name}.zip' }], + locations: [{ url: 'build/missing/${name}.zip' }, { url: 'build/${name}.zip' }], }) const componentConfig = { include: ['start-page'] } await runScenario({