mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add validation of library plugin id and better error reporting
This commit is contained in:
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
Block a user