From 9b5ed8407f293da22e66c5e0249064f80df25995 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 27 Jan 2021 22:06:12 +0000 Subject: [PATCH] Broaden lang verification to include * --- .../@node-red/editor-api/lib/editor/locales.js | 2 +- packages/node_modules/@node-red/runtime/lib/api/nodes.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/locales.js b/packages/node_modules/@node-red/editor-api/lib/editor/locales.js index ebe3e3281..f9453f55b 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/locales.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/locales.js @@ -41,7 +41,7 @@ module.exports = { var namespace = req.params[0]; namespace = namespace.replace(/\.json$/,""); var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []); - if (/[^a-z\-]/i.test(lang)) { + if (/[^a-z\-\*]/i.test(lang)) { res.json({}); return; } diff --git a/packages/node_modules/@node-red/runtime/lib/api/nodes.js b/packages/node_modules/@node-red/runtime/lib/api/nodes.js index aa5eca100..a0ce200b3 100644 --- a/packages/node_modules/@node-red/runtime/lib/api/nodes.js +++ b/packages/node_modules/@node-red/runtime/lib/api/nodes.js @@ -99,7 +99,7 @@ var api = module.exports = { return new Promise(function(resolve,reject) { var id = opts.id; var lang = opts.lang; - if (/[^a-z\-]/i.test(opts.lang)) { + if (/[^a-z\-\*]/i.test(opts.lang)) { reject(new Error("Invalid language: "+opts.lang)); return } @@ -128,7 +128,7 @@ var api = module.exports = { getNodeConfigs: function(opts) { return new Promise(function(resolve,reject) { runtime.log.audit({event: "nodes.configs.get"}, opts.req); - if (/[^a-z\-]/i.test(opts.lang)) { + if (/[^a-z\-\*]/i.test(opts.lang)) { reject(new Error("Invalid language: "+opts.lang)); return } @@ -406,7 +406,7 @@ var api = module.exports = { var namespace = opts.module; var lang = opts.lang; var prevLang = runtime.i18n.i.language; - if (/[^a-z\-]/i.test(lang)) { + if (/[^a-z\-\*]/i.test(lang)) { reject(new Error("Invalid language: "+lang)); return } @@ -439,7 +439,7 @@ var api = module.exports = { return new Promise(function(resolve,reject) { var namespace = opts.module; var lang = opts.lang; - if (/[^a-z\-]/i.test(lang)) { + if (/[^a-z\-\*]/i.test(lang)) { reject(new Error("Invalid language: "+lang)); return }