From c4e33e0f6f2271d924c8125628d2eb6c79672d31 Mon Sep 17 00:00:00 2001 From: xcps Date: Sun, 4 Feb 2018 00:00:43 +0500 Subject: [PATCH] Slice extra -000 in search string --- routes/search.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routes/search.js b/routes/search.js index 8f0984b..a9dbffc 100644 --- a/routes/search.js +++ b/routes/search.js @@ -5,7 +5,10 @@ var router = express.Router(); /* GET home page. */ router.post('/', async function(req, res, next) { - const search = encodeURI(req.body.search); + let search = encodeURI(req.body.search).trim(); + if (search.endsWith('-000')) { + search = search.slice(0, -4); + } // looking for address const address = await models.Address.findOne({