Showing
1 changed file
with
5 additions
and
2 deletions
@@ -9,6 +9,10 @@ const msg2row = require('./msg2row'); | @@ -9,6 +9,10 @@ const msg2row = require('./msg2row'); | ||
9 | const routeDecode = require('./route-decode'); | 9 | const routeDecode = require('./route-decode'); |
10 | const crypto = global.yoho.crypto; | 10 | const crypto = global.yoho.crypto; |
11 | 11 | ||
12 | +const decodeUid = _.memoize(function(r) { | ||
13 | + return crypto.decrypt(null, decodeURIComponent(r)); | ||
14 | +}); | ||
15 | + | ||
12 | const durationType = { | 16 | const durationType = { |
13 | dcl: 'domcontentload', | 17 | dcl: 'domcontentload', |
14 | ld: 'domreadyload', | 18 | ld: 'domreadyload', |
@@ -41,8 +45,7 @@ module.exports = (req, res, next) => { | @@ -41,8 +45,7 @@ module.exports = (req, res, next) => { | ||
41 | 45 | ||
42 | if (item.u) { | 46 | if (item.u) { |
43 | try { | 47 | try { |
44 | - item.u = decodeURIComponent(item.u); | ||
45 | - item.u = crypto.decrypt(null, item.u); | 48 | + item.u = decodeUid(item.u); |
46 | } catch (e) { | 49 | } catch (e) { |
47 | logger.error('decode uid error ', item.u); | 50 | logger.error('decode uid error ', item.u); |
48 | item.u = '0'; | 51 | item.u = '0'; |
-
Please register or login to post a comment