mirror of https://github.com/node-red/node-red.git
Add validation of library plugin id and better error reporting
parent
c2347076f4
commit
6f9e06e78d
|
@ -38,6 +38,11 @@ function init(runtime) {
|
|||
runtimeLibraries.forEach(library => {
|
||||
if (library.type === id) {
|
||||
library.local = false;
|
||||
|
||||
if (!/^[a-z0-9-_]+$/.test(library.id)) {
|
||||
log.warn(log._("library.failedToInit",{error:log._("library.invalidProperty",{prop:"id",value:library.id})}));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
libraries[library.id] = new plugin.class(library)
|
||||
libraryConfigs[library.id] = library;
|
||||
|
|
|
@ -93,7 +93,8 @@
|
|||
"unknownLibrary": "Unknown library: __library__",
|
||||
"unknownType": "Unknown library type: __type__",
|
||||
"readOnly": "Library __library__ is read-only",
|
||||
"failedToInit": "Failed to initialise __library__: __error__"
|
||||
"failedToInit": "Failed to initialise library __library__: __error__",
|
||||
"invalidProperty": "Invalid property __prop__: '__value__'"
|
||||
},
|
||||
"nodes": {
|
||||
"credentials": {
|
||||
|
|
Loading…
Reference in New Issue