Skip to content

Commit

Permalink
For incomprehensible reasons, google stringifies this data field
Browse files Browse the repository at this point in the history
Need to sanitize it a bit before then.
  • Loading branch information
michaeljguarino committed May 9, 2024
1 parent 0e5b3d4 commit 5da7737
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/controller/constraint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controller
import (
"context"
"fmt"
"strings"

"gopkg.in/yaml.v3"

Expand Down Expand Up @@ -120,6 +121,8 @@ func GenerateAPIConstraint(instance *unstructured.Unstructured, template *templa
if annotations := instance.GetAnnotations(); annotations != nil {
var bundleData BundleData
if d, ok := annotations[bundleDataAnnotation]; ok {
d = strings.TrimSpace(d)
d = strings.Trim(d, "\"")
if err := yaml.Unmarshal([]byte(d), &bundleData); err != nil {
pca.Description = lo.ToPtr(bundleData.Description)
pca.Recommendation = lo.ToPtr(bundleData.Remediation)
Expand Down

0 comments on commit 5da7737

Please sign in to comment.