media: Make Type comparable

So we can use it and output.Format as map key etc.

This commit also fixes the media.Type implementation so it does not need to mutate itself to handle different suffixes for the same MIME type, e.g. jpg vs. jpeg.

This means that there are no Suffix or FullSuffix on media.Type anymore.

Fixes #8317
Fixes #8324
This commit is contained in:
Bjørn Erik Pedersen
2021-03-11 09:18:01 +01:00
parent 1b1dcf586e
commit ba1d0051b4
19 changed files with 254 additions and 195 deletions

View File

@@ -265,7 +265,7 @@ func (f Format) SupportsTransparency() bool {
// DefaultExtension returns the default file extension of this format, starting with a dot.
// For example: .jpg for JPEG
func (f Format) DefaultExtension() string {
return f.MediaType().FullSuffix()
return f.MediaType().FirstSuffix.FullSuffix
}
// MediaType returns the media type of this image, e.g. image/jpeg for JPEG