Blame view

doraemon/middleware/item-name-handler.js 372 Bytes
郭成尧 authored
1 2 3 4 5 6 7 8 9 10 11 12
/**
 * 商品详情页部分商品名称重置,防止express内部decodeURIComponent不能解析url出错
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/8/23
 */

module.exports = function(req, res, next) {
    if (/^\/product\/pro_/.test(req.url)) {
        req.url = req.url.replace(/\/pro_([\d]+)_([\d]+)\/(.*)/, '/pro_$1_$2/yoho-replace.html');
    }
    next();
};