badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.52k stars 5.49k forks source link

GitHub file size badge doesn't work for some files #10548

Open chris48s opened 1 week ago

chris48s commented 1 week ago

Are you experiencing an issue with...

shields.io

🐞 Description

This badge works for most files https://img.shields.io/github/size/badges/shields/server.js but there are some that cause a problem https://img.shields.io/github/size/badges/shields/package.json The reason this fails is because this causes us to look for a file called "package" and use json output format, rather than look for a file called "package.json"

🔗 Link to the badge

https://img.shields.io/github/size/badges/shields/package.json

💡 Possible Solution

We might need to switch path from a path param to a query param to solve this.

github-actions[bot] commented 1 week ago

Badge tested using npm run badge https://img.shields.io/github/size/badges/shields/package.json Output is available here

chris48s commented 1 week ago

Note https://img.shields.io/github/size/badges/shields/package.json.svg and https://img.shields.io/github/size/badges/shields/package.json.json do work as expected, so there is a workaround for this.