mirror of
https://github.com/aclindsa/ofxgo.git
synced 2025-07-01 11:48:38 -04:00
Trim spaces when unmarshalling UIDs
This ensures the correct value is parsed when SGML tags aren't closed. Also add a test.
This commit is contained in:
10
types.go
10
types.go
@ -237,6 +237,16 @@ func (ob Boolean) Equal(o Boolean) bool {
|
||||
|
||||
type UID string
|
||||
|
||||
func (ou *UID) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
var value string
|
||||
err := d.DecodeElement(&value, &start)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*ou = UID(strings.TrimSpace(value))
|
||||
return nil
|
||||
}
|
||||
|
||||
// The OFX specification recommends that UIDs follow the standard UUID
|
||||
// 36-character format
|
||||
func (ou UID) RecommendedFormat() (bool, error) {
|
||||
|
Reference in New Issue
Block a user