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

Minor fix for URI scheme whitelist demo hook #200

Merged
merged 1 commit into from
Feb 25, 2017
Merged

Conversation

buu700
Copy link
Contributor

@buu700 buu700 commented Feb 25, 2017

We just caught an issue in @cyph that was causing links sent in succession to break as in the attached screenshot, and this turned out to be the culprit.

From the MDN docs on RegExp.test: "As with exec() (or in combination with it), test() called multiple times on the same global regular expression instance will advance past the previous match."

Test for comparison:

const regex0 = /^(http|https|ftp):/gim
const regex1 = /^(http|https|ftp):/im

regex0.test('https:')
true
regex0.test('https:')
false
regex0.test('https:')
true
regex0.test('https:')
false

regex1.test('https:')
true
regex1.test('https:')
true
regex1.test('https:')
true
regex1.test('https:')
true

screen shot 2017-02-24 at 5 27 45 pm

@cure53 cure53 merged commit 58e226e into cure53:master Feb 25, 2017
@cure53
Copy link
Owner

cure53 commented Feb 25, 2017

Nice find, thanks!

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

Successfully merging this pull request may close these issues.

2 participants