Skip to content

Minor fix for URI scheme whitelist demo hook#200

Merged
cure53 merged 1 commit into
cure53:masterfrom
buu700:master
Feb 25, 2017
Merged

Minor fix for URI scheme whitelist demo hook#200
cure53 merged 1 commit into
cure53:masterfrom
buu700:master

Conversation

@buu700

@buu700 buu700 commented Feb 25, 2017

Copy link
Copy Markdown
Contributor

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

cure53 commented Feb 25, 2017

Copy link
Copy Markdown
Owner

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