diff --git a/packages/node_modules/@node-red/registry/lib/installer.js b/packages/node_modules/@node-red/registry/lib/installer.js index 495a956af..3ffd65513 100644 --- a/packages/node_modules/@node-red/registry/lib/installer.js +++ b/packages/node_modules/@node-red/registry/lib/installer.js @@ -144,7 +144,7 @@ async function installModule(module,version,url) { if (url) { if (pkgurlRe.test(url) || localtgzRe.test(url)) { // Git remote url or Tarball url - check the valid package url - installName = url; + installName = localtgzRe.test(url) && slashRe.test(url) ? `"${url}"` : url; isRegistryPackage = false; } else { log.warn(log._("server.install.install-failed-url",{name:module,url:url})); diff --git a/test/unit/@node-red/registry/lib/installer_spec.js b/test/unit/@node-red/registry/lib/installer_spec.js index 7f514e99d..f7ca223e8 100644 --- a/test/unit/@node-red/registry/lib/installer_spec.js +++ b/test/unit/@node-red/registry/lib/installer_spec.js @@ -258,6 +258,29 @@ describe('nodes/registry/installer', function() { }).catch(done); }); + it("succeeds when file path is valid node-red module", function(done) { + var nodeInfo = {nodes:{module:"foo",types:["a"]}}; + + var res = { + code: 0, + stdout:"", + stderr:"" + } + var p = Promise.resolve(res); + p.catch((err)=>{}); + execResponse = p; + + var addModule = sinon.stub(registry,"addModule").callsFake(function(md) { + return Promise.resolve(nodeInfo); + }); + + installer.installModule("foo",null,"/example path/foo-0.1.1.tgz").then(function(info) { + exec.run.lastCall.args[1].should.eql([ 'install', '--no-audit', '--no-update-notifier', '--no-fund', '--save', '--save-prefix=~', '--omit=dev', '--engine-strict', '"/example path/foo-0.1.1.tgz"' ]); + info.should.eql(nodeInfo); + done(); + }).catch(done); + }); + it("triggers preInstall and postInstall hooks", function(done) { let receivedPreEvent,receivedPostEvent; hooks.add("preInstall", function(event) { event.args = ["a"]; receivedPreEvent = event; })