hapi-server / uri-templates

Repository of tools for URI templates
Apache License 2.0
2 stars 0 forks source link

template with field following pad=none fails #20

Closed jbfaden closed 1 year ago

jbfaden commented 1 year ago

This fails because there is a field after a field with pad=none. The position of each field in the string is no longer known, and the code relies on delimiters to position things. However the code doesn't implement this properly, clearing length for the "m" field, but not the position of the "d" and "H" fields:

doTestTimeParser1( "$y $(m;pad=none) $(d;pad=none) $(H;pad=none)", "99 1 3 0", "1999-01-03T00:00/1999-01-03T01:00" )
jbfaden commented 1 year ago

The "pos" variable wasn't cleared when pad=none was found. This is fixed.

jbfaden commented 1 year ago

Tests were added.