Github-readme-stats: Boolean query parameters incorrectly parsed

Created on 15 Jul 2020  路  1Comment  路  Source: anuraghazra/github-readme-stats

The boolean query parameters, such as show_icons, hide_border and hide_rank, are being incorrectly parsed, as passing false to them has the same effect as if passing true:


All true

With all the settings set to true, the behavior is as expected.

https://github-readme-stats.vercel.app/api?username=MicaelJarniac&show_icons=true&hide_border=true&hide_rank=true


All false

But with all settings set to false, the behavior should be the same as the default one, with no extra query at all, but it isn't.

https://github-readme-stats.vercel.app/api?username=MicaelJarniac&show_icons=false&hide_border=false&hide_rank=false


Default (no extra query)

https://github-readme-stats.vercel.app/api?username=MicaelJarniac


I believe what's happening is that the only thing being checked is whether they exist or not, and not what their values actually are.

This isn't directly affecting the usage, but is a small detail that can be rather confusing at times.

For example, I like to tweak the settings from time to time, and to make it easier, I like to have all the settings explicitly declared, so I can easily see which ones are available, and simply change their values. With the way the query is being parsed right now, that wouldn't be an option, as I'd actually have to remove the setting completely in order to change its effect.

bug

Most helpful comment

Thank you for reporting the issue @MicaelJarniac fix is on its way

>All comments

Thank you for reporting the issue @MicaelJarniac fix is on its way

Was this page helpful?
0 / 5 - 0 ratings