Authored by 郭成尧

decodeURIComponent

... ... @@ -26,6 +26,7 @@ const uuid = require('uuid');
const pkg = require('./package.json');
const hbsEvent = require('./config/hbsevent');
const _ = require('lodash');
const stringProcess = require('./utils/string-process');
const app = express();
... ... @@ -56,6 +57,7 @@ app.enable('trust proxy');
app.disable('x-powered-by');
app.use((req, res, next) => {
req.url = stringProcess.decodeURIComponent(req.url) || '/404';// 错误的网址编码重定向404
req.isApmReport = _.get(req.app.locals, 'wap.open.bughd', false); // 把错误上报的开关绑定到上下文,node-lib 库要使用
next();
});
... ... @@ -189,4 +191,3 @@ app.listen(config.port, function() {
}
});
});
... ...
... ... @@ -2,12 +2,8 @@
* URL 重写(主要用于兼容原来PHP的连接)
*/
const stringProcess = require('./../../utils/string-process');
module.exports = () => {
return (req, res, next) => {
req.url = stringProcess.decodeURIComponent(req.url) || '/404';// 错误的网址编码重定向404
if (/^\/home\/orders\/paynew/.test(req.url)) {
// 支付中心,由于微信安全配置限制在 home/orders 路径下,需要转发,误删!!!
req.url = `/cart${req.url}`;
... ...