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

Incorrect results in unescape #1827

Closed
hadeeb opened this issue Oct 25, 2021 · 1 comment · Fixed by #1835
Closed

Incorrect results in unescape #1827

hadeeb opened this issue Oct 25, 2021 · 1 comment · Fixed by #1835
Labels

Comments

@hadeeb
Copy link

hadeeb commented Oct 25, 2021

Describe the bug
unescape function produce incorrect result when the intermediate string generated includes an escape sequence.

Examples

const validator = require('validator');

validator.unescape(validator.escape('<'))

// Expected: '<'
// Actual: '<'

Demo: Stackblitz

Additional context
Validator.js version: 13.6.0
Node.js version: 14.16.0
OS platform: linux, macOS

Suggested solution
&amp; -> & transform should be the last transform in unescape.

Demo: Stackblitz

@Marcholio
Copy link
Contributor

Marcholio commented Oct 29, 2021

I submitted a PR that fixes this issue (#1835) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants