RubbaBoy / BYOB

Bring Your Own Badge - Create dynamic README badges based off of your GitHub Actions
MIT License
80 stars 10 forks source link

Invalid url should give 404 #8

Closed Mulugruntz closed 2 years ago

Mulugruntz commented 2 years ago

This is my shields.json: https://github.com/Mulugruntz/celery-pubsub/blob/shields/shields.json

If I go to this invalid URL: https://byob.yarr.is/mulugruntz/celery-pubsub/m_linux_3.8_celery345: invalid

And now, to this valid URL: https://byob.yarr.is/mulugruntz/celery-pubsub/m_linux_3.8_celery3: valid

Both return an HTTP status 200. If would be great to actually return 404 to avoid parsing the SVG. In my use case, I made a sparse matrix, so some of them should have badges and some should not.

Mulugruntz commented 2 years ago

Interesting... there's another bug about caching I believe. Now, the invalid link sometimes works and sometimes is broken. If I go directly to the link and refresh, it fixes it... for a while.

RubbaBoy commented 2 years ago

Great idea, I'm not sure why it returns 200. I'm away from my usual setup for a bit but I will try my best to get this resolved today or tomorrow. I'll look further into the caching part, that sounds strange,

RubbaBoy commented 2 years ago

This should be resolved (and reflected in production), I was unable to replicate the caching issue, is it still present for you?

BYOB will now return 404 if no config file is found, or if the badge name is not found. 400 is returned for any other invalid request, and of course 200 for a valid badge. Let me know if you think anything else should be modified, and thank you for the issue!

Mulugruntz commented 2 years ago

404 is good now. The caching is still an issue. Not sure what I'm doing that is different. image

Especially for when the image is non-existant, as you return the default 404 image, maybe it has been cached long ago and expired? Something like that...?

I'll open a different ticket...