pivotal-cf / pivnet-resource

Concourse Resource to interact with the Tanzu Network API V2 interface.
Apache License 2.0
30 stars 36 forks source link

`product_version` regex matching for the version is too relaxed #130

Open xinzweb opened 4 years ago

xinzweb commented 4 years ago

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.

khng commented 4 years ago

Thanks for the feedback!

Does this section in the documentation capture what you are describing? If so, we can update the product_version description, like you suggested, with a link to that as well to clarify to users more explicitly.

What are your thoughts on this?