Move the parsing of the media type to isXMLMediaType
This commit is contained in:
6
entry.go
6
entry.go
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -144,10 +143,7 @@ func (e *Entry) Check() error {
|
||||
// "type" attribute of atom:content is a MIME media type [MIMEREG], but
|
||||
// is not an XML media type [RFC3023], does not begin with "text/", and
|
||||
// does not end with "/xml" or "+xml".
|
||||
mediaType, _, err := mime.ParseMediaType(e.Content.getType())
|
||||
if err != nil {
|
||||
return fmt.Errorf("type attribute of content element of entry %v: %v", e.ID.URI, err)
|
||||
}
|
||||
mediaType := e.Content.getType()
|
||||
if !isXMLMediaType(mediaType) && !strings.HasPrefix(mediaType, "text/") {
|
||||
return fmt.Errorf("no summary element of entry %v but media type not xml", e.ID.URI)
|
||||
}
|
||||
|
Reference in New Issue
Block a user