Skip to content

Commit

Permalink
Fix offline resolution (#3311)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored and bestander committed May 4, 2017
1 parent 0b3c443 commit 00f6780
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion __tests__/commands/install/lockfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ const fsNode = require('fs');
const path = require('path');
const os = require('os');

test.concurrent('does fetch files from the local filesystem', (): Promise<void> => {
test('does fetch files from the local filesystem', (): Promise<void> => {
return runInstall({}, 'install-should-fetch-local-tarballs', (config): Promise<void> => {
return Promise.resolve();
}, async (cwd) => {
await fs.writeFile(`${cwd}/package.json`, (await fs.readFile(`${cwd}/package.json`)).replace(/%%CWD%%/g, cwd));
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"license": "MIT",
"dependencies": {
"fake-dependency": "./fake-dependency-1.0.1.tgz"
"fake-dependency": "./fake-dependency-1.0.1.tgz",
"@fakescope/fake-dependency": "%%CWD%%/fakescope-fake-dependency-1.0.1.tgz"
}
}
2 changes: 1 addition & 1 deletion src/fetchers/tarball-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class TarballFetcher extends BaseFetcher {
async _fetch(): Promise<FetchedOverride> {
const urlParse = url.parse(this.reference);

if (urlParse.protocol === null && urlParse.pathname.match(/^\.\.?[\/\\]/)) {
if (urlParse.protocol === null && urlParse.pathname.match(/^(?=(?:\.{1,2}|[a-z]:)?[\\\/])/i)) {
return await this.fetchFromLocal(this.reference);
}

Expand Down

0 comments on commit 00f6780

Please sign in to comment.