ActiveCampaign/mustachio

Error occurs while parsing tag names containing hyphen-minus characters ("-", unicode number: U+002D)

ArtemyB opened this issue · 0 comments

Wanted to use GUIDs as tag names, but have a trouble with parsing them - the following exception occurs: Mustachio.IndexedParseException: The path '110E6231-BA3E-40DD-AF62-9802DCC02B61' is not valid. Please see documentation for examples of valid paths.
However when I remove all dashes from the tag name all works successfully. Is that an intentional feature or rather a bug?

Code example:

var guidTemplate1Txt = "There was GUID with dashes: {{110E6231-BA3E-40DD-AF62-9802DCC02B61}}";
var guidTemplate2Txt = "There was GUID w/o dashes: {{110E6231BA3E40DDAF629802DCC02B61}}";

var template1 = Mustachio.Parser.Parse(guidTemplate1Txt);
var template2 = Mustachio.Parser.Parse(guidTemplate2Txt);

var model1 = new Dictionary<string, obj>() { { "110E6231-BA3E-40DD-AF62-9802DCC02B61", "content" } };

var model2 = new Dictionary<string, obj>() { { "110E6231BA3E40DDAF629802DCC02B61", "content" } };

var content1 = template1(model1); // Mustachio.IndexedParseException is thrown there
var content2 = template2(model2); // Works successfully