esmero / strawberryfield

A Field of strawberries
GNU Lesser General Public License v3.0
10 stars 5 forks source link

JMESPATH splitting by ',' in Key name providers fails to detect commas that are inside an expression #333

Closed DiegoPino closed 3 weeks ago

DiegoPino commented 1 month ago

What?

I should have known better. But a complex JMESPATH expression e.g

[date_created_edtf][?"date_type" == 'date_range'][ join('/',[date_from,date_to])][]

Will be split in two because we blindly split by comma

The solution is to use regular expression for splitting.

In specific this little one

$pattern = '/[,]+(?![^\[]*\]|[^\(]*\)|[^\{]*\})/';

@patdunlavey you will need this to test your date ranges! Pull coming before you start your day I hope (testing in production now) @alliomeria server indexing again!

DiegoPino commented 3 weeks ago

Fixed via https://github.com/esmero/strawberryfield/commit/0c6b0e71c30daf5c923d09527cdf49802cdff3cc