This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(urlUtils): make IPv6 URL's hostname wrapped in square brackets in IE/Edge #16715
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
mgol
added a commit
to mgol/angular.js
that referenced
this pull request
Oct 11, 2018
… IE/Edge IE 9-11 and Edge 16-17 (fixed in 18 Preview) incorrectly don't wrap IPv6 addresses' hostnames in square brackets when parsed out of an anchor element. Fixes angular#16692 Closes angular#16715
I added a support test to avoid an overhead of additional regex testing per each URL passing through |
gkalpak
suggested changes
Oct 11, 2018
src/ng/urlUtils.js
Outdated
@@ -72,13 +78,19 @@ function urlResolve(url) { | |||
|
|||
urlParsingNode.setAttribute('href', href); | |||
|
|||
var hostname = urlParsingNode.hostname; | |||
|
|||
if (!ipv6InBrackets && /[\da-e:]+/.test(hostname)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a-f
in the RegExp?
Also, you probably meant /^[...]+$/
(to match the whole hostname, not just a part of it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-by-one error! I broke https://google.com
parsing. 😱 Fixed.
mgol
added a commit
to mgol/angular.js
that referenced
this pull request
Oct 11, 2018
… IE/Edge IE 9-11 and Edge 16-17 (fixed in 18 Preview) incorrectly don't wrap IPv6 addresses' hostnames in square brackets when parsed out of an anchor element. Fixes angular#16692 Closes angular#16715
gkalpak
approved these changes
Oct 11, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jbedard
reviewed
Oct 17, 2018
mgol
commented
Oct 17, 2018
… IE/Edge IE 9-11 and Edge 16-17 (fixed in 18 Preview) incorrectly don't wrap IPv6 addresses' hostnames in square brackets when parsed out of an anchor element. Fixes angular#16692 Closes angular#16715
gkalpak
approved these changes
Oct 18, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
A bug fix.
What is the current behavior? (You can also link to an open issue here)
In IE 9-11 and Edge 16-17 (not in 18 Preview)
$location.host()
incorrectly returns hostnames of IPv6 addresses without wrapping in square brackets.This is caused by and IE/Edge bug which incorrectly don't wrap IPv6 addresses' hostnames in square brackets when parsed out of an anchor element which is used by
$location
for the purpose of URL parsing.Issue: #16692
What is the new behavior (if this is a feature change)?
For all supported browsers
$location.host()
returns an IPv6 address wrapped in square brackets.Does this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
Other information: