mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
loadNodeConfig assumed to always be called with module and name parameters
This commit is contained in:
parent
71bd5cd9e9
commit
9552055b08
@ -475,18 +475,13 @@ function loadNodesFromModule(moduleDir,pkg) {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function loadNodeConfig(file,module,name) {
|
function loadNodeConfig(file,module,name) {
|
||||||
var id = crypto.createHash('sha1').update(file).digest("hex");
|
var id = crypto.createHash('sha1').update(module+":"+name).digest("hex");
|
||||||
if (module && name) {
|
var existingInfo = registry.getNodeInfo(id);
|
||||||
var newid = crypto.createHash('sha1').update(module+":"+name).digest("hex");
|
if (existingInfo) {
|
||||||
var existingInfo = registry.getNodeInfo(id);
|
// For a brief period, id for modules were calculated incorrectly.
|
||||||
if (existingInfo) {
|
// To prevent false-duplicates, this removes the old id entry
|
||||||
// For a brief period, id for modules were calculated incorrectly.
|
registry.removeNode(id);
|
||||||
// To prevent false-duplicates, this removes the old id entry
|
registry.saveNodeList();
|
||||||
registry.removeNode(id);
|
|
||||||
registry.saveNodeList();
|
|
||||||
}
|
|
||||||
id = newid;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
var info = registry.getNodeInfo(id);
|
var info = registry.getNodeInfo(id);
|
||||||
|
|
||||||
@ -507,12 +502,8 @@ function loadNodeConfig(file,module,name) {
|
|||||||
loaded:false
|
loaded:false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (module) {
|
node.name = module+":"+name;
|
||||||
node.name = module+":"+name;
|
node.module = module;
|
||||||
node.module = module;
|
|
||||||
} else {
|
|
||||||
node.name = path.basename(file);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
var content = fs.readFileSync(node.template,'utf8');
|
var content = fs.readFileSync(node.template,'utf8');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user