Skip to content

Server serving svg with mimetype image/svg instead of image/svg+xml #4920

@cirocosta

Description

@cirocosta

Hey,

Firstly, thanks for putting so much effort on Hugo!

I just update Hugo to v0.43/extended darwin/amd64 BuildDate: 2018-07-09T10:21:26Z in order to test the resource bundling & minification functionality (coming from v0.40 I guess), and I noticed that my svg images don't render in Chrome anymore when using hugo serve.

Looking further into it, that's due to the server serving the images as image/svg instead of the standard image/svg+xml:


screen shot 2018-07-09 at 10 40 52

hugo serve ^

screen shot 2018-07-09 at 10 41 28

http-server -p 1313 ^

I guess this is a known issue given the following comment (https://github.com/gohugoio/hugo/blame/dea71670c059ab4d5a42bd22503f18c087dd22d4/media/mediaType.go#L97):

// The official MIME type of SVG is image/svg+xml. We currently only support one extension
// per mime type. The workaround in projects is to create multiple media type definitions,
// but we need to improve this to take other known suffixes into account.
// But until then, svg has an svg extension, which is very common. TODO(bep)

Given that this is a regression and is something known, maybe we could work on the docs to provide such explanation and an example of how to work around it?

Thanks very much!
Ciro

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions