mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Fix plugin loading when browser sends unrecognised lang
This commit is contained in:
		| @@ -17,9 +17,8 @@ module.exports = { | ||||
|             }) | ||||
|         } else { | ||||
|             opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages()); | ||||
|             if (/[^a-z\-\*]/i.test(opts.lang)) { | ||||
|                 res.json({}); | ||||
|                 return; | ||||
|             if (/[^0-9a-z=\-\*]/i.test(opts.lang)) { | ||||
|                 opts.lang = "en-US"; | ||||
|             } | ||||
|             runtimeAPI.plugins.getPluginConfigs(opts).then(function(configs) { | ||||
|                 res.send(configs); | ||||
| @@ -32,9 +31,8 @@ module.exports = { | ||||
|             lang: req.query.lng, | ||||
|             req: apiUtils.getRequestLogObject(req) | ||||
|         } | ||||
|         if (/[^a-z\-\*]/i.test(opts.lang)) { | ||||
|             res.json({}); | ||||
|             return; | ||||
|         if (/[^0-9a-z=\-\*]/i.test(opts.lang)) { | ||||
|             opts.lang = "en-US"; | ||||
|         } | ||||
|         runtimeAPI.plugins.getPluginCatalogs(opts).then(function(result) { | ||||
|             res.json(result); | ||||
|   | ||||
| @@ -58,7 +58,7 @@ var api = module.exports = { | ||||
|     * @memberof @node-red/runtime_plugins | ||||
|     */ | ||||
|     getPluginConfigs: async function(opts) { | ||||
|         if (/[^a-z\-]/i.test(opts.lang)) { | ||||
|         if (/[^0-9a-z=\-\*]/i.test(opts.lang)) { | ||||
|             throw new Error("Invalid language: "+opts.lang) | ||||
|             return; | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user