Showing
4 changed files
with
1 additions
and
34 deletions
@@ -145,7 +145,6 @@ try { | @@ -145,7 +145,6 @@ try { | ||
145 | const layoutTools = require('./doraemon/middleware/layout-tools'); | 145 | const layoutTools = require('./doraemon/middleware/layout-tools'); |
146 | const pageCache = require('./doraemon/middleware/page-cache'); | 146 | const pageCache = require('./doraemon/middleware/page-cache'); |
147 | const devtool = require('./doraemon/middleware/devtools'); | 147 | const devtool = require('./doraemon/middleware/devtools'); |
148 | - const pathDecode = require('./doraemon/middleware/path-decode'); | ||
149 | const routeEncode = require('./doraemon/middleware/route-encode'); | 148 | const routeEncode = require('./doraemon/middleware/route-encode'); |
150 | 149 | ||
151 | // YOHO 前置中间件 | 150 | // YOHO 前置中间件 |
@@ -165,7 +164,6 @@ try { | @@ -165,7 +164,6 @@ try { | ||
165 | app.use(setPageInfo()); | 164 | app.use(setPageInfo()); |
166 | app.use(layoutTools()); | 165 | app.use(layoutTools()); |
167 | app.use(pageCache()); | 166 | app.use(pageCache()); |
168 | - app.use(pathDecode()); | ||
169 | app.use(routeEncode.md); | 167 | app.use(routeEncode.md); |
170 | 168 | ||
171 | if (app.locals.devEnv) { | 169 | if (app.locals.devEnv) { |
@@ -120,7 +120,7 @@ router.get(/\/list\/(.*)-new/, list.newWithChannel); | @@ -120,7 +120,7 @@ router.get(/\/list\/(.*)-new/, list.newWithChannel); | ||
120 | // 商品分类列表页 | 120 | // 商品分类列表页 |
121 | router.get('/list', gbk2utf, list.index); | 121 | router.get('/list', gbk2utf, list.index); |
122 | router.get('/list/index', gbk2utf, list.index); | 122 | router.get('/list/index', gbk2utf, list.index); |
123 | -router.get('/list/:pathQs', paramParse, list.index); | 123 | +router.get('/list/:pathQs', paramParse, gbk2utf, list.index); |
124 | 124 | ||
125 | // 品牌店铺 | 125 | // 品牌店铺 |
126 | router.get('/index/about', list.brandAbout); // 品牌店铺介绍页 | 126 | router.get('/index/about', list.brandAbout); // 品牌店铺介绍页 |
doraemon/middleware/path-decode.js
deleted
100644 → 0
1 | -/** | ||
2 | - * 处理伪静态化路由编码中间中间件 | ||
3 | - * @author: yyq<yanqing.yang@yoho.cn> | ||
4 | - * @date: 2017/12/26 | ||
5 | - */ | ||
6 | - | ||
7 | -const urlEncode = require('urlencode'); | ||
8 | -const _ = require('lodash'); | ||
9 | - | ||
10 | - | ||
11 | -module.exports = () => { | ||
12 | - return (req, res, next) => { | ||
13 | - let path = req.path; | ||
14 | - | ||
15 | - | ||
16 | - if (!req.xhr && _.indexOf(path, '%') > -1) { | ||
17 | - try { | ||
18 | - req.url = decodeURIComponent(path); | ||
19 | - } catch (e) { | ||
20 | - try { | ||
21 | - req.url = urlEncode.decode(path, 'gb2312'); | ||
22 | - } catch (e1) { | ||
23 | - return next(); | ||
24 | - } | ||
25 | - } | ||
26 | - } | ||
27 | - | ||
28 | - return next(); | ||
29 | - }; | ||
30 | -}; |
-
Please register or login to post a comment