Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure TarballFetcher error messages contain names of problematic files #5964

Merged
merged 2 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions __tests__/fetchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ test('TarballFetcher.fetch throws on truncated tar data', async () => {
},
await Config.create({}, reporter),
);
await expect(fetcher.fetch()).rejects.toThrow(new RegExp(reporter.lang('errorExtractingTarball', '.*', '.*')));
await expect(fetcher.fetch()).rejects.toThrow(
// The "." in ".tgz" should be escaped, but that doesn't work with reporter.lang
new RegExp(reporter.lang('errorExtractingTarball', '.*', '.*broken-tar-data.tgz')),
);
});

test('TarballFetcher.fetch throws on truncated tar header', async () => {
Expand All @@ -329,5 +332,8 @@ test('TarballFetcher.fetch throws on truncated tar header', async () => {
},
await Config.create({}, reporter),
);
await expect(fetcher.fetch()).rejects.toThrow(new RegExp(reporter.lang('errorExtractingTarball', '.*', '.*')));
await expect(fetcher.fetch()).rejects.toThrow(
// The "." in ".tgz" should be escaped, but that doesn't work with reporter.lang
new RegExp(reporter.lang('errorExtractingTarball', '.*', '.*broken-tar-header.tgz')),
);
});
2 changes: 1 addition & 1 deletion src/util/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ export async function readFirstAvailableStream(
if (tarballPath) {
try {
const fd = await open(tarballPath, 'r');
stream = fs.createReadStream('', {fd});
stream = fs.createReadStream(tarballPath, {fd});
break;
} catch (err) {
// Try the next one
Expand Down