1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-29 10:55:05 +00:00

fix annotation path error if applied to pod controller

This commit is contained in:
Shuting Zhao 2020-01-14 15:57:02 -08:00
parent 6b8aa9df34
commit fbe6ea2f24

View file

@ -387,11 +387,11 @@ func preparePath(path string) string {
}
annPath := "/metadata/annotations/"
idx := strings.Index(path, annPath)
// escape slash in annotation patch
if strings.Contains(path, annPath) {
idx := strings.Index(path, annPath)
p := path[idx+len(annPath):]
path = annPath + strings.ReplaceAll(p, "/", "~1")
path = path[:idx+len(annPath)] + strings.ReplaceAll(p, "/", "~1")
}
return path
}