Authored by 郭成尧

decodeURIComponent

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