Skip to content

browse/content: Set image content type when requesting raw content

Currently when querying the /browse/content/raw endpoint, the Content-Type header of the HTTP response is set to text/plain when the content is textual to force browser rendering and to application/octet-stream otherwise to force file download.

However some image formats can be rendered by browsers and it seems better to display them instead of offering their downloads, so ensure those will be rendered by browsers.

It notably fixes SVG rendering in README files when data can be fetched from the archive content, see this origin for instance, SVG logo at top of the README is currently not rendered.

Edited by Antoine Lambert

Merge request reports