From f67c2032a4ef200726dc73b254b324a9bbe15add Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Tue, 24 Mar 2020 12:21:15 +0530 Subject: [PATCH] fix: use typeof instead of instanceof instanceof fails to check for string, instead classifying the $target.data('value') as instanceof Object; which causes the ternary check to fail and pass filter without decodeURIComponent(), causing filter to be applied like: email%40example.com instead of email@example.com we can instead just use typeof to check whether the passed value is a string Signed-off-by: Chinmay D. Pai --- frappe/public/js/frappe/list/list_sidebar_group_by.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/list/list_sidebar_group_by.js b/frappe/public/js/frappe/list/list_sidebar_group_by.js index f494da9058..707ee9fb5d 100644 --- a/frappe/public/js/frappe/list/list_sidebar_group_by.js +++ b/frappe/public/js/frappe/list/list_sidebar_group_by.js @@ -167,7 +167,7 @@ frappe.views.ListGroupBy = class ListGroupBy { this.$wrapper.on('click', '.group-by-item', (e) => { let $target = $(e.currentTarget); let fieldname = $target.parents('.group-by-field').find('a').data('fieldname'); - let value = $target.data('value') instanceof String? decodeURIComponent($target.data('value').trim()): $target.data('value'); + let value = typeof $target.data('value') === 'string' ? decodeURIComponent($target.data('value').trim()) : $target.data('value'); fieldname = fieldname === 'assigned_to' ? '_assign': fieldname; return this.list_view.filter_area.remove(fieldname)