Skip to content

Commit

Permalink
Merge pull request #24 from HPInc/fix-prod
Browse files Browse the repository at this point in the history
Skip empty production path encoding
  • Loading branch information
qmuntal committed Apr 16, 2021
2 parents 0d8b1cd + a16291b commit 221d4b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions production/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func (u *ObjectAttr) Marshal3MFAttr(_ spec.Encoder) ([]xml.Attr, error) {

// Marshal3MFAttr encodes the resource attributes.
func (p *ItemAttr) Marshal3MFAttr(_ spec.Encoder) ([]xml.Attr, error) {
if p.Path == "" {
return []xml.Attr{
{Name: xml.Name{Space: Namespace, Local: attrProdUUID}, Value: p.UUID},
}, nil
}
return []xml.Attr{
{Name: xml.Name{Space: Namespace, Local: attrPath}, Value: p.Path},
{Name: xml.Name{Space: Namespace, Local: attrProdUUID}, Value: p.UUID},
Expand All @@ -33,6 +38,11 @@ func (p *ItemAttr) Marshal3MFAttr(_ spec.Encoder) ([]xml.Attr, error) {

// Marshal3MFAttr encodes the resource attributes.
func (p *ComponentAttr) Marshal3MFAttr(_ spec.Encoder) ([]xml.Attr, error) {
if p.Path == "" {
return []xml.Attr{
{Name: xml.Name{Space: Namespace, Local: attrProdUUID}, Value: p.UUID},
}, nil
}
return []xml.Attr{
{Name: xml.Name{Space: Namespace, Local: attrPath}, Value: p.Path},
{Name: xml.Name{Space: Namespace, Local: attrProdUUID}, Value: p.UUID},
Expand Down

0 comments on commit 221d4b9

Please sign in to comment.