'Ktor not serving static images properly

I have a ktor server, and I'm trying to serve some static assets that are stored in resources folder assets.

static("/assets") {
    resources("assets")
}

For .css files it works when I fetch them with something like http://0.0.0.0:7200/assets/css/main.css, but when I try to fetch images with http://localhost:7200/assets/img/flags/uk.png, it returns a broken image, although it exists.

enter image description here

enter image description here

I've tried different image formats and paths. Also tried different ways of serving the resources, but none worked.

Edit (Beginning of image downloaded from browser): enter image description here

Edit (Beginning of original file, why are they slightly different?): enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source