Ocpp: fix hasProperty() (#15550)

This commit is contained in:
premultiply 2024-08-21 00:15:50 +02:00 • committed by GitHub
parent f7df472b4b
commit fa0a438ebc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -333,7 +333,7 @@ func (c *OCPP) hasMeasurement(val types.Measurand) bool {
// hasProperty checks if comma-separated string contains given string ignoring whitespaces
func (c *OCPP) hasProperty(props string, prop string) bool {
return slices.ContainsFunc(strings.Split(props, ","), func(s string) bool {
return prop == strings.TrimSpace(s)
return strings.HasPrefix(strings.ReplaceAll(s, " ", ""), prop)
})
}