From a0ce0958070c945319065c90f6177a6d8a309a13 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 29 Jun 2015 16:00:10 +0100 Subject: [PATCH] Error generating complete flow library list on OSX Must use path.join to concatenate paths safely. --- red/storage/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/red/storage/index.js b/red/storage/index.js index 9d5dcfa8e..8fd91cafd 100644 --- a/red/storage/index.js +++ b/red/storage/index.js @@ -15,6 +15,7 @@ **/ var when = require('when'); +var Path = require('path'); var storageModule; var settingsAvailable; @@ -90,9 +91,9 @@ var storageModuleInterface = { return when.resolve(); } }, - + /* Library Functions */ - + getLibraryEntry: function(type, path) { if (is_malicious(path)) { return when.reject(new Error('forbidden flow name')); @@ -105,7 +106,7 @@ var storageModuleInterface = { } return storageModule.saveLibraryEntry(type, path, meta, body); }, - + /* Deprecated functions */ getAllFlows: function() { if (storageModule.hasOwnProperty("getAllFlows")) { @@ -123,7 +124,7 @@ var storageModuleInterface = { } else { return storageModule.getLibraryEntry("flows",fn); } - + }, saveFlow: function(fn, data) { if (is_malicious(fn)) { @@ -136,7 +137,7 @@ var storageModuleInterface = { } } /* End deprecated functions */ - + } @@ -146,7 +147,7 @@ function listFlows(path) { var promises = []; res.forEach(function(r) { if (typeof r === "string") { - promises.push(listFlows(path+r)); + promises.push(listFlows(Path.join(path,r))); } else { promises.push(when.resolve(r)); }