Add check for whether a mime type is used for inline other and out of line content
This commit is contained in:
parent
7764589dd3
commit
1f7f7966ef
@ -27,7 +27,13 @@ func (i *InlineOtherContent) hasSRC() bool { return false }
|
|||||||
func (i *InlineOtherContent) getType() string { return string(i.Type) }
|
func (i *InlineOtherContent) getType() string { return string(i.Type) }
|
||||||
|
|
||||||
func (i *InlineOtherContent) Check() error {
|
func (i *InlineOtherContent) Check() error {
|
||||||
if isCompositeMediaType(i.getType()) {
|
mediaType := i.getType()
|
||||||
|
|
||||||
|
if mediaType, _, err := mime.ParseMediaType(mediaType); err != nil {
|
||||||
|
return fmt.Errorf("type attribute %v incompatible with inline other content", mediaType)
|
||||||
|
}
|
||||||
|
|
||||||
|
if isCompositeMediaType(mediaType) {
|
||||||
return errors.New("type attribute of inline other content must not be a composite type")
|
return errors.New("type attribute of inline other content must not be a composite type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,13 @@ func (o *OutOfLineContent) hasSRC() bool { return true }
|
|||||||
func (o *OutOfLineContent) getType() string { return string(o.Type) }
|
func (o *OutOfLineContent) getType() string { return string(o.Type) }
|
||||||
|
|
||||||
func (o *OutOfLineContent) Check() error {
|
func (o *OutOfLineContent) Check() error {
|
||||||
if isCompositeMediaType(o.getType()) {
|
mediaType := o.getType()
|
||||||
|
|
||||||
|
if mediaType, _, err := mime.ParseMediaType(mediaType); err != nil {
|
||||||
|
return fmt.Errorf("type attribute %v incompatible with out of line content", mediaType)
|
||||||
|
}
|
||||||
|
|
||||||
|
if isCompositeMediaType(mediaType) {
|
||||||
return errors.New("type attribute of out of line content must not be a composite type")
|
return errors.New("type attribute of out of line content must not be a composite type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user