mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fix incorrect MIME type from image/jpg to image/jpeg
According to multiple sources, both official ([IANA] and [RFC2046]) and otherwise (eg, [Mozilla] and [Wikipedia]), the official MIME type for JPEG images is `image/jpeg`, not `image/jpg`. Change Hugo to match. [IANA]: https://www.iana.org/assignments/media-types/media-types.xhtml#image [RFC2046]: https://tools.ietf.org/html/rfc2046 [Mozilla]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types [Wikipedia]: https://en.wikipedia.org/wiki/JPEG
This commit is contained in:
parent
eef934ae7e
commit
158e7ec204
6 changed files with 15 additions and 15 deletions
|
@ -88,7 +88,7 @@ Sometimes it can be useful to create the filter chain once and then reuse it:
|
||||||
|
|
||||||
Provides an [Exif](https://en.wikipedia.org/wiki/Exif) object with metadata about the image.
|
Provides an [Exif](https://en.wikipedia.org/wiki/Exif) object with metadata about the image.
|
||||||
|
|
||||||
Note that this is only suported for JPG and TIFF images, so it's recommended to wrap the access with a `with`, e.g.:
|
Note that this is only suported for JPEG and TIFF images, so it's recommended to wrap the access with a `with`, e.g.:
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ with $img.Exif }}
|
{{ with $img.Exif }}
|
||||||
|
|
|
@ -17,7 +17,7 @@ menu:
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
ResourceType
|
ResourceType
|
||||||
: The main type of the resource. For example, a file of MIME type `image/jpg` has the ResourceType `image`.
|
: The main type of the resource. For example, a file of MIME type `image/jpeg` has the ResourceType `image`.
|
||||||
|
|
||||||
Name
|
Name
|
||||||
: Default value is the filename (relative to the owning page). Can be set in front matter.
|
: Default value is the filename (relative to the owning page). Can be set in front matter.
|
||||||
|
@ -35,7 +35,7 @@ Content
|
||||||
: The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
|
: The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
|
||||||
|
|
||||||
MediaType
|
MediaType
|
||||||
: The MIME type of the resource, such as `image/jpg`.
|
: The MIME type of the resource, such as `image/jpeg`.
|
||||||
|
|
||||||
MediaType.MainType
|
MediaType.MainType
|
||||||
: The main type of the resource's MIME type. For example, a file of MIME type `application/pdf` has for MainType `application`.
|
: The main type of the resource's MIME type. For example, a file of MIME type `application/pdf` has for MainType `application`.
|
||||||
|
|
|
@ -1501,10 +1501,10 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "image/jpg",
|
"type": "image/jpeg",
|
||||||
"string": "image/jpg",
|
"string": "image/jpeg",
|
||||||
"mainType": "image",
|
"mainType": "image",
|
||||||
"subType": "jpg",
|
"subType": "jpeg",
|
||||||
"delimiter": ".",
|
"delimiter": ".",
|
||||||
"suffixes": [
|
"suffixes": [
|
||||||
"jpg",
|
"jpg",
|
||||||
|
|
|
@ -126,12 +126,12 @@ BG4: {{ $blurryGrayscale4.RelPermalink }}/{{ $blurryGrayscale4.Width }}
|
||||||
b := newBuilder("10ns")
|
b := newBuilder("10ns")
|
||||||
|
|
||||||
imgExpect := `
|
imgExpect := `
|
||||||
Resized1: images/sunset.jpg|123|234|image/jpg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_123x234_resize_q75_box.jpg|
|
Resized1: images/sunset.jpg|123|234|image/jpeg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_123x234_resize_q75_box.jpg|
|
||||||
Resized2: images/sunset.jpg|12|23|image/jpg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_ada4bb1a57f77a63306e3bd67286248e.jpg|
|
Resized2: images/sunset.jpg|12|23|image/jpeg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_ada4bb1a57f77a63306e3bd67286248e.jpg|
|
||||||
Resized3: sunset.jpg|345|678|image/jpg|/mybundle/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_345x678_resize_q75_box.jpg|
|
Resized3: sunset.jpg|345|678|image/jpeg|/mybundle/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_345x678_resize_q75_box.jpg|
|
||||||
Resized4: sunset.jpg|34|67|image/jpg|/mybundle/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_44d8c928664d7c5a67377c6ec58425ce.jpg|
|
Resized4: sunset.jpg|34|67|image/jpeg|/mybundle/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_44d8c928664d7c5a67377c6ec58425ce.jpg|
|
||||||
Resized5: images/sunset.jpg|456|789|image/jpg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_456x789_resize_q75_box.jpg|
|
Resized5: images/sunset.jpg|456|789|image/jpeg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_456x789_resize_q75_box.jpg|
|
||||||
Resized6: images/sunset.jpg|350|219|image/jpg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_350x0_resize_q75_box.a86fe88d894e5db613f6aa8a80538fefc25b20fa24ba0d782c057adcef616f56.jpg|
|
Resized6: images/sunset.jpg|350|219|image/jpeg|/images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_350x0_resize_q75_box.a86fe88d894e5db613f6aa8a80538fefc25b20fa24ba0d782c057adcef616f56.jpg|
|
||||||
BG1: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_2ae8bb993431ec1aec40fe59927b46b4.jpg/123
|
BG1: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_2ae8bb993431ec1aec40fe59927b46b4.jpg/123
|
||||||
BG2: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_2ae8bb993431ec1aec40fe59927b46b4.jpg/123
|
BG2: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_2ae8bb993431ec1aec40fe59927b46b4.jpg/123
|
||||||
BG3: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_ed7740a90b82802261c2fbdb98bc8082.jpg/123
|
BG3: /images/sunset_hu59e56ffff1bc1d8d122b1403d34e039f_90587_ed7740a90b82802261c2fbdb98bc8082.jpg/123
|
||||||
|
|
|
@ -140,7 +140,7 @@ var (
|
||||||
|
|
||||||
// Common image types
|
// Common image types
|
||||||
PNGType = Type{MainType: "image", SubType: "png", Suffixes: []string{"png"}, Delimiter: defaultDelimiter}
|
PNGType = Type{MainType: "image", SubType: "png", Suffixes: []string{"png"}, Delimiter: defaultDelimiter}
|
||||||
JPGType = Type{MainType: "image", SubType: "jpg", Suffixes: []string{"jpg", "jpeg"}, Delimiter: defaultDelimiter}
|
JPEGType = Type{MainType: "image", SubType: "jpeg", Suffixes: []string{"jpg", "jpeg"}, Delimiter: defaultDelimiter}
|
||||||
GIFType = Type{MainType: "image", SubType: "gif", Suffixes: []string{"gif"}, Delimiter: defaultDelimiter}
|
GIFType = Type{MainType: "image", SubType: "gif", Suffixes: []string{"gif"}, Delimiter: defaultDelimiter}
|
||||||
TIFFType = Type{MainType: "image", SubType: "tiff", Suffixes: []string{"tif", "tiff"}, Delimiter: defaultDelimiter}
|
TIFFType = Type{MainType: "image", SubType: "tiff", Suffixes: []string{"tif", "tiff"}, Delimiter: defaultDelimiter}
|
||||||
BMPType = Type{MainType: "image", SubType: "bmp", Suffixes: []string{"bmp"}, Delimiter: defaultDelimiter}
|
BMPType = Type{MainType: "image", SubType: "bmp", Suffixes: []string{"bmp"}, Delimiter: defaultDelimiter}
|
||||||
|
@ -174,7 +174,7 @@ var DefaultTypes = Types{
|
||||||
YAMLType,
|
YAMLType,
|
||||||
TOMLType,
|
TOMLType,
|
||||||
PNGType,
|
PNGType,
|
||||||
JPGType,
|
JPEGType,
|
||||||
AVIType,
|
AVIType,
|
||||||
MPEGType,
|
MPEGType,
|
||||||
MP4Type,
|
MP4Type,
|
||||||
|
|
|
@ -275,7 +275,7 @@ func (f Format) DefaultExtension() string {
|
||||||
func (f Format) MediaType() media.Type {
|
func (f Format) MediaType() media.Type {
|
||||||
switch f {
|
switch f {
|
||||||
case JPEG:
|
case JPEG:
|
||||||
return media.JPGType
|
return media.JPEGType
|
||||||
case PNG:
|
case PNG:
|
||||||
return media.PNGType
|
return media.PNGType
|
||||||
case GIF:
|
case GIF:
|
||||||
|
|
Loading…
Reference in a new issue