Merge pull request #779 from CartoDB/res-locals-user
Don't overwrite data in copy from req.params to res.locals
This commit is contained in:
commit
448dcc7d82
@ -1,8 +1,6 @@
|
||||
const _ = require('underscore');
|
||||
|
||||
module.exports = function localsMiddleware(req, res, next) {
|
||||
_.extend(res.locals, req.params);
|
||||
|
||||
// save req.params in res.locals
|
||||
res.locals = Object.assign(req.params || {}, res.locals);
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
|
@ -4,11 +4,5 @@ var cdbRequest = new CdbRequest();
|
||||
module.exports = function userMiddleware(req, res, next) {
|
||||
res.locals.user = cdbRequest.userByReq(req);
|
||||
|
||||
// avoid a req.params.user equals to undefined
|
||||
// overwrites res.locals.user
|
||||
if(!req.params.user) {
|
||||
delete req.params.user;
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user