From 4ff664601a293da0f142d961f3268dfa601b775b Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Fri, 26 Jun 2015 17:00:15 +0900 Subject: [PATCH] Add back the requirement to have at least one dot for any version filter. I thought it didn't make much sense but then I realized that an unquoted search for "Nexus 5" would most likely match all Nexus devices due to the fields being handled separately. --- res/app/device-list/column/device-column-service.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/res/app/device-list/column/device-column-service.js b/res/app/device-list/column/device-column-service.js index 83846f50..6c26feb8 100644 --- a/res/app/device-list/column/device-column-service.js +++ b/res/app/device-list/column/device-column-service.js @@ -87,6 +87,15 @@ module.exports = function DeviceColumnService($filter, gettext) { , lb = vb.length , op = filterOps[filter.op || '='] + // We have a single value and no operator or field. It matches + // too easily, let's wait for a dot (e.g. '5.'). An example of a + // bad match would be an unquoted query for 'Nexus 5', which targets + // a very specific device but may easily match every Nexus device + // as the two terms are handled separately. + if (filter.op === null && filter.field === null && lb === 1) { + return false + } + if (vb[lb - 1] === '') { // This means that the query is not complete yet, and we're // looking at something like "4.", which means that the last part