Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo server adds unnecessary charset parameter to Content-Type for images #10734

Closed
SpecLad opened this issue Feb 19, 2023 · 4 comments · Fixed by #12038
Closed

hugo server adds unnecessary charset parameter to Content-Type for images #10734

SpecLad opened this issue Feb 19, 2023 · 4 comments · Fixed by #12038

Comments

@SpecLad
Copy link

SpecLad commented Feb 19, 2023

What version of Hugo are you using (hugo version)?

> hugo version
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168+extended windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes.


Add an image to a site's static directory, run hugo server, and look at the headers it gets served with:

> curl -I http://localhost:1313/images/cicero.jpg
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 23595
Content-Type: image/jpeg; charset=utf-8
Last-Modified: Thu, 16 Feb 2023 19:49:44 GMT
Date: Sun, 19 Feb 2023 18:09:32 GMT

The Content-Type is set to image/jpeg; charset=utf-8, which is clearly wrong, as images don't have a charset parameter.

It's a minor issue, and I haven't noticed it actually breaking anything, but still, it's a bug.

@bep bep removed the NeedsTriage label Feb 19, 2023
@bep bep added this to the v0.112.0 milestone Feb 19, 2023
@bep
Copy link
Member

bep commented Feb 19, 2023

i suspect this is an upstream issue (we use the file server in the Go stdlib) -- and I suspect it's implemented this way for simplicity, and I'm not totally sure that it has any practical downside.

@jmooring
Copy link
Member

It's been like this for years. Given that the server is not intended for production, I agree that there is no practical downside.

It worked as expected in v0.54.0, but stopped working with v0.55.0. Git bisect says
597e418 is the first bad commit.

@SpecLad
Copy link
Author

SpecLad commented Feb 19, 2023

Seems like the behavior is implemented here:

_ = mime.AddExtensionType(mt.Delimiter+suffix, mt.Type()+"; charset=utf-8")

@bep bep modified the milestones: v0.112.0, v0.113.0 Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.115.0 Jun 13, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 5, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
Copy link

github-actions bot commented Mar 9, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants