mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02:00
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:
@@ -59,7 +59,7 @@ func FormatFromString(formatStr string) Format {
|
||||
// FormatFromMediaType gets the Format given a MIME type, empty string
|
||||
// if unknown.
|
||||
func FormatFromMediaType(m media.Type) Format {
|
||||
for _, suffix := range m.Suffixes {
|
||||
for _, suffix := range m.Suffixes() {
|
||||
if f := FormatFromString(suffix); f != "" {
|
||||
return f
|
||||
}
|
||||
|
Reference in New Issue
Block a user