CurseForgeBadge-Unofficial
CurseForgeBadge-Unofficial copied to clipboard
How to use names with underscores in them
Hello way2muchnoise,
I'm trying to figure out how I can create a total downloads badge for a user with an underscore in their name. Example: Corgi_Taco. Was wondering whether there's a way to escape said underscore somehow.
Cheers, Griefed
Hey,
I tried to escape the underscore like described here: https://stackoverflow.com/questions/2222519/url-encoding-with-underscores-in-a-directory-name/2222555
This leads to a url like: https://cf.way2muchnoise.eu/author/Corgi%255FTaco.svg
But this does not work. I think this line is the problem:
https://github.com/way2muchnoise/CurseForgeBadge/blob/84e5a5e2d9475a95986f764adb792968f10bd631/CFReader.py#L45
The F
of %255F
is lowered down and this leads to a failed underscore escaping. I think, this line is unnecessary and maybe when it is removed, it could work. :)
Couldn't we simply replace underscores with tildes in the syntax (ie. Corgi~Taco)? I'm pretty sure ~
characters are illegal for usernames but legal for urls. It feels kind of backwards, but it should go around the issue of having to redesign the app to allow for escape characters.
Another perhaps better option would be to move all of the style syntax to get parameters like https://cf.way2muchnoise.eu/author/full_way2muchnoise_downloads.svg
=> https://cf.way2muchnoise.eu/author/way2muchnoise.svg?style=full&suffix=downloads
That, of course, would break all backwards compatibility.