subject-f / guyamoe

Kaguya Manga Reader Website
https://guya.moe
GNU Affero General Public License v3.0
462 stars 66 forks source link

Remove deprecated usage of unescape #77

Closed Rapptz closed 3 years ago

Rapptz commented 3 years ago

This should be using decodeURIComponent instead. To demonstrate why:

>> encodeURIComponent("お前")
<- "%E3%81%8A%E5%89%8D"
>> decodeURIComponent("%E3%81%8A%E5%89%8D")
<- "お前"
>> unescape("%E3%81%8A%E5%89%8D")
<- "ã\u0081\u008aå\u0089\u008d"

This causes the title innerHTML to break a URL since it can't find the proper path to splice, giving you a 404 if the series has characters outside of the ASCII range.