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:
parent
37935bf388
commit
9b5ed8407f
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user