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

Text validation of URI with a surrogate pair #238

Open
artem-zakharchenko opened this issue Jul 11, 2019 · 1 comment
Open

Text validation of URI with a surrogate pair #238

artem-zakharchenko opened this issue Jul 11, 2019 · 1 comment

Comments

@artem-zakharchenko
Copy link
Contributor

Previous implementation of Gavel contained a dedicated unit test for ensuring URIs with surrogate pairs in them are validated correctly by TextDiff:

describe('when i create new instance of validator with surrogate pair in data', () => {
validator = null;
it('should not throw exception', () => {
const fn = () => {
validator = new TextDiff('text1\uD800', '\uD800text1');
};
assert.doesNotThrow(fn);
});
describe('when I run validate', () => {
it('should not throw exception', () => {
const fn = () => validator.validate();
assert.doesNotThrow(fn);
});
});
});

Implementation:

const sanitizeSurrogatePairs = (data) => {
return data
.replace(/[\uD800-\uDBFF]/g, '')
.replace(/[\uDC00-\uDFFF]/g, '');
};

Originally introduced in dac0eff.

During the API redesign we have discovered that removing the surrogate pairs handling still gives a passing test suite, so I'm removing the tests and implementation until more details are known about the intended behavior.

@honzajavorek
Copy link
Contributor

@tu1ly I know this is ancient history, but do you happen to remember the original context for this?

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

No branches or pull requests

2 participants