1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Error generating complete flow library list on OSX

Must use path.join to concatenate paths safely.
This commit is contained in:
Nick O'Leary 2015-06-29 16:00:10 +01:00
parent df0110913a
commit a0ce095807

View File

@ -15,6 +15,7 @@
**/ **/
var when = require('when'); var when = require('when');
var Path = require('path');
var storageModule; var storageModule;
var settingsAvailable; var settingsAvailable;
@ -90,9 +91,9 @@ var storageModuleInterface = {
return when.resolve(); return when.resolve();
} }
}, },
/* Library Functions */ /* Library Functions */
getLibraryEntry: function(type, path) { getLibraryEntry: function(type, path) {
if (is_malicious(path)) { if (is_malicious(path)) {
return when.reject(new Error('forbidden flow name')); return when.reject(new Error('forbidden flow name'));
@ -105,7 +106,7 @@ var storageModuleInterface = {
} }
return storageModule.saveLibraryEntry(type, path, meta, body); return storageModule.saveLibraryEntry(type, path, meta, body);
}, },
/* Deprecated functions */ /* Deprecated functions */
getAllFlows: function() { getAllFlows: function() {
if (storageModule.hasOwnProperty("getAllFlows")) { if (storageModule.hasOwnProperty("getAllFlows")) {
@ -123,7 +124,7 @@ var storageModuleInterface = {
} else { } else {
return storageModule.getLibraryEntry("flows",fn); return storageModule.getLibraryEntry("flows",fn);
} }
}, },
saveFlow: function(fn, data) { saveFlow: function(fn, data) {
if (is_malicious(fn)) { if (is_malicious(fn)) {
@ -136,7 +137,7 @@ var storageModuleInterface = {
} }
} }
/* End deprecated functions */ /* End deprecated functions */
} }
@ -146,7 +147,7 @@ function listFlows(path) {
var promises = []; var promises = [];
res.forEach(function(r) { res.forEach(function(r) {
if (typeof r === "string") { if (typeof r === "string") {
promises.push(listFlows(path+r)); promises.push(listFlows(Path.join(path,r)));
} else { } else {
promises.push(when.resolve(r)); promises.push(when.resolve(r));
} }