Page MenuHomeSoftware Heritage

Create error badge for repositories that are not found in SWH
Closed, ResolvedPublic

Description

From the README side,
@scatenag noticed that if the repository has not been acquired by software heritage we get a broken image.

He is suggesting something like

:

Event Timeline

moranegg triaged this task as Normal priority.Dec 12 2019, 8:53 PM
moranegg created this task.

I am confused because this is already implemented. I just tested again and I got exactly the badge posted above when the origin is not found in the archive.

I need more details on this.

Well .. It is a strange behavior .. possibly related to GitHub ..

Have a look at
https://github.com/scatenag/CMM/blob/master/README.md

The first badge is

[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/Unipisa/CMM/)](https://archive.softwareheritage.org/browse/origin/https://github.com/Unipisa/CMM/)

If you follow the link https://archive.softwareheritage.org/badge/origin/https://github.com/Unipisa/CMM/ you get the right (origin not found) badge,
but GitHub renders it as broken image link.

On the contrary, when the origin is found, GitHub renders the badge correctly: see for instance https://github.com/Unipisa/TAUmus

I think I understand what's wrong here. Github will not render a badge if the associated HTTP request to get the image data does not return a 200 status code.
As the badge endpoint returns a 404 error code when an origin is not archived, the error badge is not displayed.
I will fix that behavior and deploy a new version of swh-web during the afternoon.

@scatenag , issue fixed and deployed. Thanks for reporting it !