might use this to censor/bypass filters
example:
https://github.com/torvalds
=> 'https://github.com/%74%6f%72%76%61%6c%64%73'
might use this to censor/bypass filters
example:
https://github.com/torvalds
=> 'https://github.com/%74%6f%72%76%61%6c%64%73'
"".split("/") | |
.map((p, i) => | |
i >= 3 | |
? p | |
.split("") | |
.map((c) => | |
"?#".includes(c) | |
? c | |
: `%${c.charCodeAt(0).toString(16).padStart(2, "0")}`, | |
) | |
.join("") | |
: p, | |
) | |
.join("/") |
.split("/").map((i,a)=>a>=3?i.split("").map(t=>"?#".includes(t)?t:`%${t.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""):i).join("/") |