From a16291b49bc709f8e26633997a3dc3a6c7487738 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Fri, 16 Apr 2021 10:29:02 +0200 Subject: [PATCH] skip empty production path encoding --- production/encoder.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/production/encoder.go b/production/encoder.go index d64a4bb..a6b5a3b 100644 --- a/production/encoder.go +++ b/production/encoder.go @@ -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}, @@ -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},