From f133aebfaf6259c14f96dcbdbce2d9358fdde562 Mon Sep 17 00:00:00 2001 From: Olaf Tomalka Date: Wed, 25 Jul 2018 00:37:48 +0200 Subject: Fixed the relative resolver not checking if the file can be read in the first place --- packages/sol-resolver/src/resolvers/relative_fs_resolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/sol-resolver/src') diff --git a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts index 77103b8c1..ed96040d3 100644 --- a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts +++ b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts @@ -14,7 +14,7 @@ export class RelativeFSResolver extends Resolver { // tslint:disable-next-line:prefer-function-over-method public resolveIfExists(importPath: string): ContractSource | undefined { const filePath = path.join(this._contractsDir, importPath); - if (fs.existsSync(filePath)) { + if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory()) { const fileContent = fs.readFileSync(filePath).toString(); return { source: fileContent, -- cgit v1.2.3 From 25a8554be1550e00fba023fd56a3a6e181888e81 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Mon, 13 Aug 2018 14:17:05 -0700 Subject: fix(sol-compiler, sol-resolver): Bug where sol-resolver tried to read a directory (#961) fix(sol-compiler, sol-resolver): Fix bug where sol-resolver tried to read a directory --- packages/sol-resolver/src/resolvers/npm_resolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/sol-resolver/src') diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts index 9f8617145..a2df0dcad 100644 --- a/packages/sol-resolver/src/resolvers/npm_resolver.ts +++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts @@ -19,7 +19,7 @@ export class NPMResolver extends Resolver { const ROOT_PATH = '/'; while (currentPath !== ROOT_PATH) { const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage); - if (fs.existsSync(lookupPath)) { + if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) { const fileContent = fs.readFileSync(lookupPath).toString(); return { source: fileContent, -- cgit v1.2.3