From 840e89071d634c63f97058df6f0f9233ad6f9fad Mon Sep 17 00:00:00 2001 From: saarraz1 Date: Fri, 25 Mar 2016 13:13:05 +0300 Subject: [PATCH 1/2] Bug fix allowing diamond dependencies. The current version would fail if a "diamond" dependency existed, for example: a.proto: message A { } b.proto: import "a.proto"; message B { } c.proto: import "a.proto"; import "b.proto"; --> ERROR: Duplicate message A defined. The previous code does have a mechanism to avoid this (the 'loaded' object) but it is not passed down to recursive calls into readProto, which is a bug. Passing it down fixes the problem. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 86e2de1..ac8fca8 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ module.exports = function (source) { return; } loaded[fileName] = true; - data.imports[index] = readProto(fs.readFileSync(fileName).toString('utf8')); + data.imports[index] = readProto(fs.readFileSync(fileName).toString('utf8'), {}, loaded); return; } throw Error('File not found: ' + imp); From e040e2a3806ef05107d78efd94afb16dc61824bc Mon Sep 17 00:00:00 2001 From: saarraz1 Date: Fri, 25 Mar 2016 13:17:41 +0300 Subject: [PATCH 2/2] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ac8fca8..d09565b 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ module.exports = function (source) { return; } loaded[fileName] = true; - data.imports[index] = readProto(fs.readFileSync(fileName).toString('utf8'), {}, loaded); + data.imports[index] = readProto(fs.readFileSync(fileName).toString('utf8'), options, loaded); return; } throw Error('File not found: ' + imp);