mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 05:30:54 +03: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:
parent
1b1dcf586e
commit
ba1d0051b4
19 changed files with 254 additions and 195 deletions
|
@ -432,7 +432,7 @@ func (lf *localFile) ContentType() string {
|
|||
}
|
||||
|
||||
ext := filepath.Ext(lf.NativePath)
|
||||
if mimeType, found := lf.mediaTypes.GetFirstBySuffix(strings.TrimPrefix(ext, ".")); found {
|
||||
if mimeType, _, found := lf.mediaTypes.GetFirstBySuffix(strings.TrimPrefix(ext, ".")); found {
|
||||
return mimeType.Type()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue