route-decode.js
309 Bytes
const crypto = global.yoho.crypto;
const _ = require('lodash');
const decode = _.memoize(function(r) {
return crypto.decrypt(null, r);
});
module.exports = function(r) {
try {
let s = decode(r);
s = s.replace(/[^\w\/\^\(\)\[\]+-\.\*:]/g, '');
return s;
} catch (e) {
return r;
}
};