diff --git a/atom/parser.go b/atom/parser.go index a29ac139..19082035 100644 --- a/atom/parser.go +++ b/atom/parser.go @@ -658,20 +658,12 @@ func (ap *Parser) parseAtomText(p *xpp.XMLPullParser) (string, error) { InnerXML string `xml:",innerxml"` } - // DecodeElement pops the base stack if the element contains an xml:base - // attribute, so we need to save and restore it before resolving any - // relative URLs below - oldBase := p.BaseStack + // get current base URL before it is clobbered by DecodeElement + base := p.BaseStack.Top() err := p.DecodeElement(&text) if err != nil { return "", err } - newBase := p.BaseStack - p.BaseStack = oldBase - defer func() { - // pop base when we're done with the decoded element - p.BaseStack = newBase - }() result := text.InnerXML result = strings.TrimSpace(result) @@ -682,7 +674,7 @@ func (ap *Parser) parseAtomText(p *xpp.XMLPullParser) (string, error) { if strings.Contains(result, "