mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	Fix reverse proxies breaking admin translations
This commit is contained in:
		| @@ -3,7 +3,7 @@ | ||||
| (function (factory) { | ||||
| 	'use strict'; | ||||
| 	function loadClient(language, namespace) { | ||||
| 		return Promise.resolve(jQuery.getJSON(config.relative_path + '/api/language/' + language + '/' + encodeURIComponent(namespace))); | ||||
| 		return Promise.resolve(jQuery.getJSON(config.relative_path + '/api/language/' + language + '/' + namespace)); | ||||
| 	} | ||||
| 	var warn = function () {}; | ||||
| 	if (typeof config === 'object' && config.environment === 'development') { | ||||
|   | ||||
| @@ -185,7 +185,7 @@ middleware.applyBlacklist = function (req, res, next) { | ||||
|  | ||||
| middleware.getTranslation = function (req, res, next) { | ||||
| 	var language = req.params.language; | ||||
| 	var namespace = req.params.namespace; | ||||
| 	var namespace = req.params[0]; | ||||
|  | ||||
| 	if (language && namespace) { | ||||
| 		languages.get(language, namespace, function (err, translations) { | ||||
|   | ||||
| @@ -144,7 +144,7 @@ module.exports = function (app, middleware, hotswapIds) { | ||||
| 	} | ||||
|  | ||||
| 	app.use(middleware.privateUploads); | ||||
| 	app.use(relativePath + '/api/language/:language/:namespace', middleware.getTranslation); | ||||
| 	app.use(relativePath + '/api/language/:language/(([a-zA-Z0-9\\-_.\\/]+))', middleware.getTranslation); | ||||
| 	app.use(relativePath, express.static(path.join(__dirname, '../../', 'public'), { | ||||
| 		maxAge: app.enabled('cache') ? 5184000000 : 0 | ||||
| 	})); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user