From 5e42b4ac0c0ccfbbd54140621b535a263de9886f Mon Sep 17 00:00:00 2001 From: Harish Krishna Date: Thu, 16 Oct 2014 16:32:17 -0400 Subject: [PATCH] de-dupe as part of sanitizing --- sanitiser/_id.js | 5 +++++ test/unit/sanitiser/get.js | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/sanitiser/_id.js b/sanitiser/_id.js index 62860243..8f165f22 100644 --- a/sanitiser/_id.js +++ b/sanitiser/_id.js @@ -29,6 +29,11 @@ function sanitize( req ){ req.clean.ids = []; params.ids = Array.isArray(params.id) ? params.id : [params.id]; + // de-dupe + params.ids = params.ids.filter(function(item, pos) { + return params.ids.indexOf(item) == pos; + }); + for (var i=0; i