From 22145e2e51b99fddd49de924b6b000cd0b29ccc4 Mon Sep 17 00:00:00 2001 From: Matt Lauber Date: Mon, 15 Feb 2016 08:31:23 -0500 Subject: [PATCH] Fix for #2274 List fields (such as tags) when evaluated to produce tiddlers result in empty arrays. Using the exact not equals, an empty array is not the same as an empty string. By using equivelent not equals, we state that the field is either != "" or anything that can be coerced to "". Which, based on https://dorey.github.io/JavaScript-Equality-Table/ is `false` `0` `[]` or `[[]]`` neither `false` nor `0` can be set as a tiddler field as both will end up being quoted (`"false"`, `"0"`) so this should work. --- core/modules/filters/has.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/filters/has.js b/core/modules/filters/has.js index 9a82f3111..f19bda492 100644 --- a/core/modules/filters/has.js +++ b/core/modules/filters/has.js @@ -25,7 +25,7 @@ exports.has = function(source,operator,options) { }); } else { source(function(tiddler,title) { - if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] !== "") { + if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] != "") { results.push(title); } });