evazion / translate-pixiv-tags

MIT License
35 stars 6 forks source link

Use safe regex match function for singular code lines #39

Closed BrokenEagle closed 5 years ago

BrokenEagle commented 5 years ago

I noticed qTip errors for the following artist:

https://www.pixiv.net/member_illust.php?id=6638325 https://danbooru.donmai.us/artists/188558

Looking into it, it seems like it's because one of the URLs is malformed. That is one issue, however the issue also exists that some of the regex matching was being done unsafely, i.e. they generate exceptions when there is no match. I've noticed similar issues in my own code, and I've been working to root them out.

But rather than fixing it in just that place, I went around and fixed all other similar places, and since there was enough of them I just created a specialized function for it.