diff --git a/red/api/editor/library.js b/red/api/editor/library.js index d5cbb020f..fd9c2d085 100644 --- a/red/api/editor/library.js +++ b/red/api/editor/library.js @@ -102,9 +102,10 @@ module.exports = { var fullPath = redNodes.getNodeExampleFlowPath(module,path); if (fullPath) { try { - fs.statSync(fullPath); + var resolvedPath = fspath.resolve(fullPath); + fs.statSync(resolvedPath); log.audit({event: "library.get",type:"flow",path:req.params[0]},req); - return res.sendFile(fullPath,{ + return res.sendFile(resolvedPath,{ headers:{ 'Content-Type': 'application/json' } diff --git a/test/red/api/editor/library_spec.js b/test/red/api/editor/library_spec.js index 65e53e459..f921596a3 100644 --- a/test/red/api/editor/library_spec.js +++ b/test/red/api/editor/library_spec.js @@ -225,7 +225,7 @@ describe("api/editor/library", function() { throw err; } res.body.should.have.property('sendFile', - 'node-module:example-one'); + fspath.resolve('node-module') + ':example-one'); done(); }); }); @@ -243,7 +243,8 @@ describe("api/editor/library", function() { throw err; } res.body.should.have.property('sendFile', - '@org_scope/node_package:example-one'); + fspath.resolve('@org_scope/node_package') + + ':example-one'); done(); }); });