badges / shields

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

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

Open chris48s opened 2 months ago

chris48s commented 2 months 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 2 months ago

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

chris48s commented 2 months 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.