mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' into dev
This commit is contained in:
@@ -369,12 +369,12 @@ class Flow {
|
||||
return undefined;
|
||||
}
|
||||
// console.log((new Error().stack).toString().split("\n").slice(1,3).join("\n"))
|
||||
if ((this.flow.configs && this.flow.configs[id]) || (this.flow.nodes && this.flow.nodes[id])) {
|
||||
if ((this.flow.configs && this.flow.configs[id]) || (this.flow.nodes && this.flow.nodes[id] && this.flow.nodes[id].type.substring(0,8) != "subflow:")) {
|
||||
// This is a node owned by this flow, so return whatever we have got
|
||||
// During a stop/restart, activeNodes could be null for this id
|
||||
return this.activeNodes[id];
|
||||
} else if (this.activeNodes[id]) {
|
||||
// TEMP: this is a subflow internal node within this flow
|
||||
// TEMP: this is a subflow internal node within this flow or subflow instance node
|
||||
return this.activeNodes[id];
|
||||
} else if (this.subflowInstanceNodes[id]) {
|
||||
return this.subflowInstanceNodes[id];
|
||||
|
@@ -697,7 +697,9 @@ async function updateFlow(id,newFlow, user) {
|
||||
|
||||
nodes = [tabNode].concat(newFlow.nodes||[]).concat(newFlow.configs||[]);
|
||||
nodes.forEach(function(n) {
|
||||
n.z = id;
|
||||
if (n.type !== 'tab') {
|
||||
n.z = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -215,6 +215,22 @@ function followParentContext(parent, key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function validateContextKey(key) {
|
||||
try {
|
||||
const keys = Array.isArray(key) ? key : [key];
|
||||
if(!keys.length) { return false }; //no key to get/set
|
||||
for (let index = 0; index < keys.length; index++) {
|
||||
const k = keys[index];
|
||||
if (typeof k !== "string" || !k.length) {
|
||||
return false; //not string or zero-length
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function createContext(id,seed,parent) {
|
||||
// Seed is only set for global context - sourced from functionGlobalContext
|
||||
var scope = id;
|
||||
@@ -251,11 +267,11 @@ function createContext(id,seed,parent) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperties(obj, {
|
||||
get: {
|
||||
value: function(key, storage, callback) {
|
||||
var context;
|
||||
|
||||
if (!callback && typeof storage === 'function') {
|
||||
callback = storage;
|
||||
storage = undefined;
|
||||
@@ -263,7 +279,14 @@ function createContext(id,seed,parent) {
|
||||
if (callback && typeof callback !== 'function'){
|
||||
throw new Error("Callback must be a function");
|
||||
}
|
||||
|
||||
if (!validateContextKey(key)) {
|
||||
var err = Error("Invalid context key");
|
||||
if(callback) {
|
||||
return callback(err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(key)) {
|
||||
var keyParts = util.parseContextStore(key);
|
||||
key = keyParts.key;
|
||||
@@ -337,7 +360,6 @@ function createContext(id,seed,parent) {
|
||||
set: {
|
||||
value: function(key, value, storage, callback) {
|
||||
var context;
|
||||
|
||||
if (!callback && typeof storage === 'function') {
|
||||
callback = storage;
|
||||
storage = undefined;
|
||||
@@ -345,7 +367,14 @@ function createContext(id,seed,parent) {
|
||||
if (callback && typeof callback !== 'function'){
|
||||
throw new Error("Callback must be a function");
|
||||
}
|
||||
|
||||
if (!validateContextKey(key)) {
|
||||
var err = Error("Invalid context key");
|
||||
if(callback) {
|
||||
return callback(err);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(key)) {
|
||||
var keyParts = util.parseContextStore(key);
|
||||
key = keyParts.key;
|
||||
|
@@ -291,7 +291,7 @@ function parseLog(log) {
|
||||
currentCommit = {}
|
||||
return;
|
||||
}
|
||||
var m = /^(.*): (.*)$/.exec(l);
|
||||
var m = /^(.*?): (.*)$/.exec(l);
|
||||
if (m) {
|
||||
// git 2.1.4 (Debian Stable) doesn't support %D for refs - so filter out
|
||||
if (m[1] === 'refs' && m[2]) {
|
||||
|
Reference in New Issue
Block a user