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:
parent
6b8aa9df34
commit
fbe6ea2f24
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue