pivnet-resource icon indicating copy to clipboard operation
pivnet-resource copied to clipboard

`product_version` regex matching for the version is too relaxed

Open xinzweb opened this issue 4 years ago • 1 comments

When we add 5\..*, not only 5.0.0 will be matched, but also anything with 5. in it will be matched, e.g. 6.5.0 will also be matched. This caused some unexpected behavior when we are using it.

We saw the reference at https://github.com/pivotal-cf/pivnet-resource/blob/master/filter/filter.go#L40, where regexp.MatchString(version, release.Version) will be able to match the string in any position.

Maybe update the product_version description to highlight the usage, e.g. adding anchor ^5\..* in order to match any 5.* releases. Or, make the regexp.MatchString more strict to always add a ^ anchor automatically in front the version.

xinzweb avatar May 27 '20 22:05 xinzweb