zola: The Zola 0.13.0 server no longer provides a `content-type` for any files, leaving the browser to guess the type of all files.

Bug Report

Environment

Zola version: 0.13.0

Expected Behavior

  • The main page of my site loads an .svg file via an <img> tag.
  • I just switched from Zola 0.10.0 to 0.13.0.
  • In Zola 0.13.0 the .svg file is no longer served correctly.

Current Behavior

  • Zola 0.10.0 served the file with the correct Content-Type, image/svg+xml.
  • Zola 0.13.0 provides no Content-Type for .svg files, leaving the browser to guess.
  • Both Chrome and Safari guess xml rather than svg.

In fact, Zola 0.13.0 no longer provides the Content-Type for any files, leaving the browser to guess the type of all files.

Step to reproduce

  1. Create a basic site.
  2. Add an svg-based <img> to the site’s main page.
  3. Serve the site in Zola 0.10.0. The <img> is presented correctly.
  4. Serve the site in Zola 0.13.0. The <img> is not presented correctly.
  5. Run curl -I http://127.0.0.1:1111/<path to svg> in Zola 0.10.0. Note the presence of a content-type header.
  6. Run curl -I http://127.0.0.1:1111/<path to svg> in Zola 0.13.0. Note the absence of a content-type header.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

It should be fixed in the next branch

I’m not a Rust developer, so I can’t build and test the change

If you’d like to try to build it, it doesn’t have to be complicated. If you have rust installed on your machine, it’s as easy as:

# Download the source code into zola folder
git clone https://github.com/getzola/zola
# Go into zola folder
cd zola
# Check out the latest developments
git checkout next
# Build the source code (to target/release/zola)
cargo build --release
# Copy the program somewhere you will be able to access it
cp target/release/zola /PATH/TO/zola

Where /PATH/TO/zola is the full path to where zola should be installed. On most platforms, /usr/local/bin/ will be a good place. Note these commands only work on UNIX-based systems (including macOS), so if you’re running windows you’ll have to dig into it or wait for the next release 😃

Leave it open to avoid duplicates

makes sense

Think I just got this issue in v0.13 when using Javascript modules during zola serve

Error: failed to load module script: expected a javascript module script but the server responded with a mime type of "". strict mime type checking is enforced for module scripts per html spec.

So, I tested it with next-build. It’s Fixed thankfully