Skip to content

Commit

Permalink
fix oci export
Browse files Browse the repository at this point in the history
Signed-off-by: aabidsofi19 <[email protected]>
  • Loading branch information
aabidsofi19 committed Feb 3, 2025
1 parent a91a3f5 commit ef06109
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion server/handlers/meshery_pattern_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,26 @@ func (h *Handler) DownloadMesheryPatternHandler(
}
defer file.Close()

ymlDesign, err := yaml.Marshal(pattern.PatternFile)
var design patternV1beta1.PatternFile

err = encoding.Unmarshal([]byte(pattern.PatternFile), &design)

if err != nil {

err = ErrEncodePattern(err)
h.log.Error(err)
http.Error(rw, fmt.Sprintf("Failed to export design \"%s\" as OCI image.", pattern.Name), http.StatusInternalServerError)
event := eventBuilder.WithSeverity(events.Error).WithMetadata(map[string]interface{}{
"error": err,
}).WithDescription(fmt.Sprintf("Failed to export design \"%s\" as OCI image.", pattern.Name)).Build()
_ = provider.PersistEvent(event)
go h.config.EventBroadcaster.Publish(userID, event)

return
}

ymlDesign, err := yaml.Marshal(design)

if err != nil {
err = ErrEncodePattern(err)
h.log.Error(err)
Expand Down

0 comments on commit ef06109

Please sign in to comment.