mirror of https://github.com/node-red/node-red.git
Merge pull request #4949 from AGhorab-upland/master
Add qoutes when installing local tgz to fix spacing in the file pathpull/4990/head
commit
03507c2a1f
|
@ -144,7 +144,7 @@ async function installModule(module,version,url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
if (pkgurlRe.test(url) || localtgzRe.test(url)) {
|
if (pkgurlRe.test(url) || localtgzRe.test(url)) {
|
||||||
// Git remote url or Tarball url - check the valid package 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;
|
isRegistryPackage = false;
|
||||||
} else {
|
} else {
|
||||||
log.warn(log._("server.install.install-failed-url",{name:module,url:url}));
|
log.warn(log._("server.install.install-failed-url",{name:module,url:url}));
|
||||||
|
|
|
@ -258,6 +258,29 @@ describe('nodes/registry/installer', function() {
|
||||||
}).catch(done);
|
}).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) {
|
it("triggers preInstall and postInstall hooks", function(done) {
|
||||||
let receivedPreEvent,receivedPostEvent;
|
let receivedPreEvent,receivedPostEvent;
|
||||||
hooks.add("preInstall", function(event) { event.args = ["a"]; receivedPreEvent = event; })
|
hooks.add("preInstall", function(event) { event.args = ["a"]; receivedPreEvent = event; })
|
||||||
|
|
Loading…
Reference in New Issue