1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

Merge pull request #625 from nirmata/mutation_bug

fix annotation path error if applied to pod controller
This commit is contained in:
shuting 2020-01-14 16:27:58 -08:00 committed by GitHub
commit ab5bb75f2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
}