Skip to content

Commit

Permalink
skip empty production path encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Apr 16, 2021
1 parent 0d8b1cd commit a16291b
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 a16291b

Please sign in to comment.