Authored by yyq

del path decode

... ... @@ -145,7 +145,6 @@ try {
const layoutTools = require('./doraemon/middleware/layout-tools');
const pageCache = require('./doraemon/middleware/page-cache');
const devtool = require('./doraemon/middleware/devtools');
const pathDecode = require('./doraemon/middleware/path-decode');
const routeEncode = require('./doraemon/middleware/route-encode');
// YOHO 前置中间件
... ... @@ -165,7 +164,6 @@ try {
app.use(setPageInfo());
app.use(layoutTools());
app.use(pageCache());
app.use(pathDecode());
app.use(routeEncode.md);
if (app.locals.devEnv) {
... ...
... ... @@ -120,7 +120,7 @@ router.get(/\/list\/(.*)-new/, list.newWithChannel);
// 商品分类列表页
router.get('/list', gbk2utf, list.index);
router.get('/list/index', gbk2utf, list.index);
router.get('/list/:pathQs', paramParse, list.index);
router.get('/list/:pathQs', paramParse, gbk2utf, list.index);
// 品牌店铺
router.get('/index/about', list.brandAbout); // 品牌店铺介绍页
... ...
/**
* 处理伪静态化路由编码中间中间件
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/12/26
*/
const urlEncode = require('urlencode');
const _ = require('lodash');
module.exports = () => {
return (req, res, next) => {
let path = req.path;
if (!req.xhr && _.indexOf(path, '%') > -1) {
try {
req.url = decodeURIComponent(path);
} catch (e) {
try {
req.url = urlEncode.decode(path, 'gb2312');
} catch (e1) {
return next();
}
}
}
return next();
};
};
... ... @@ -25,7 +25,6 @@ const minToFullMap = {
cl: 'color',
pc: 'price',
bd: 'brand',
qr: 'query',
lt: 'limit',
ld: 'limited',
od: 'order',
... ...