Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Expand decode rule #100

Open
DrKain opened this issue Oct 27, 2023 · 1 comment
Open

Request: Expand decode rule #100

DrKain opened this issue Oct 27, 2023 · 1 comment
Labels
enhancement New feature or request priority: low Low priority

Comments

@DrKain
Copy link
Owner

DrKain commented Oct 27, 2023

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==
@DrKain DrKain added enhancement New feature or request priority: low Low priority labels Oct 27, 2023
DrKain added a commit that referenced this issue Nov 1, 2023
Expanded decode handler to support more encoding methods. See issue #100 for more information.
Currently supported: hex, base64, url and url2.
url2 is a special case used in issue #72
@DrKain
Copy link
Owner Author

DrKain commented Nov 1, 2023

Currently supported:

base64
hex
url
url2 (#72)

Still needed to close this issue:

binary
base32,
base45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low Low priority
Projects
None yet
Development

No branches or pull requests

1 participant