1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Broaden lang verification to include *

This commit is contained in:
Nick O'Leary 2021-01-27 22:06:12 +00:00
parent 37935bf388
commit 9b5ed8407f
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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
}