Skip to content

WebP images don't embed in markdown

Summary

When you add images in markdown, only PNG, JPEG, GIF (and perhaps a few more) formats are supported. WebP images don't embed correctly.

Steps to reproduce

Add a WebP image to your repository and add this to README.md: ![error](image.webp).

Example Project

https://gitlab.com/zipdox/git-readme-embed-test/

What is the current bug behavior?

Now when you look at the README in your browser you will see the text "error" instead of the image.

What is the expected correct behavior?

Display the image correctly like with PNG and JPEG.

Possible fixes

I appears that for WebP images GitLab is setting the image src to /user/repo/-/blob/master/image.webp when it should be setting it to /user/repo/-/raw/master/image.webp. This can probably be fixed by adding WebP to a list of allowed image formats somewhere.