tidy-url
tidy-url copied to clipboard
Request: Expand decode rule
Right now the decode parameter is limited to base64. I would like to add support for other encodings using the same decode
handler. If no decode method is provided then base64 should be the default. If you encounter a link that fits this issue please comment it below, any samples are greatly appreciated and will help with testing.
Below are a few different two way encodings that should be safe to add. All result in the same URL.
Testing can be done here.
Example:
const rule = {
name: 'website.com',
match: /website.com/i,
decode: { param: 'd', encoding: 'hex' }
}
// Input: https://website.com/tracker?d=68747470733a2f2f6769746875622e636f6d2f44724b61696e2f746964792d75726c2f
// Output: https://github.com/DrKain/tidy-url/
binary
0110100001110100011101000111000001110011001110100010111100101111011001110110100101110100011010000111010101100010001011100110001101101111011011010010111101000100011100100100101101100001011010010110111000101111011101000110100101100100011110010010110101110101011100100110110000101111
hex
68747470733a2f2f6769746875622e636f6d2f44724b61696e2f746964792d75726c2f
url
https%3A%2F%2Fgithub.com%2FDrKain%2Ftidy-url%2F
base32
NB2HI4DTHIXS6Z3JORUHKYROMNXW2L2EOJFWC2LOF52GSZDZFV2XE3BP
base45
A9DIWENPEJ/5D3DAWEZ$E+%5+3E+/59KE7EC$-DBWEQVCRX5.KE21
base64
aHR0cHM6Ly9naXRodWIuY29tL0RyS2Fpbi90aWR5LXVybA==
Currently supported:
base64 hex url url2 (#72)
Still needed to close this issue:
binary base32, base45