Skip to content

Commit d96d66d

Browse files
For incomprehensible reasons, google stringifies this data field (#184)
Need to sanitize it a bit before then.
1 parent 0e5b3d4 commit d96d66d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/controller/constraint_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package controller
33
import (
44
"context"
55
"fmt"
6+
"strings"
67

78
"gopkg.in/yaml.v3"
89

@@ -120,7 +121,9 @@ func GenerateAPIConstraint(instance *unstructured.Unstructured, template *templa
120121
if annotations := instance.GetAnnotations(); annotations != nil {
121122
var bundleData BundleData
122123
if d, ok := annotations[bundleDataAnnotation]; ok {
123-
if err := yaml.Unmarshal([]byte(d), &bundleData); err != nil {
124+
d = strings.TrimSpace(d)
125+
d = strings.Trim(d, "\"")
126+
if err := yaml.Unmarshal([]byte(d), &bundleData); err == nil {
124127
pca.Description = lo.ToPtr(bundleData.Description)
125128
pca.Recommendation = lo.ToPtr(bundleData.Remediation)
126129
} else {

0 commit comments

Comments
 (0)