mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #1891 from camlow325/resolve-example-path-for-windows-support
Resolve path when sending example file for Windows support
This commit is contained in:
commit
c49f722e4f
@ -102,9 +102,10 @@ module.exports = {
|
|||||||
var fullPath = redNodes.getNodeExampleFlowPath(module,path);
|
var fullPath = redNodes.getNodeExampleFlowPath(module,path);
|
||||||
if (fullPath) {
|
if (fullPath) {
|
||||||
try {
|
try {
|
||||||
fs.statSync(fullPath);
|
var resolvedPath = fspath.resolve(fullPath);
|
||||||
|
fs.statSync(resolvedPath);
|
||||||
log.audit({event: "library.get",type:"flow",path:req.params[0]},req);
|
log.audit({event: "library.get",type:"flow",path:req.params[0]},req);
|
||||||
return res.sendFile(fullPath,{
|
return res.sendFile(resolvedPath,{
|
||||||
headers:{
|
headers:{
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ describe("api/editor/library", function() {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
res.body.should.have.property('sendFile',
|
res.body.should.have.property('sendFile',
|
||||||
'node-module:example-one');
|
fspath.resolve('node-module') + ':example-one');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -243,7 +243,8 @@ describe("api/editor/library", function() {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
res.body.should.have.property('sendFile',
|
res.body.should.have.property('sendFile',
|
||||||
'@org_scope/node_package:example-one');
|
fspath.resolve('@org_scope/node_package') +
|
||||||
|
':example-one');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user