Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(urlUtils): made removal of windows drive from path safer #4942

Closed
wants to merge 1 commit into from

Conversation

jeffbcross
Copy link
Contributor

Prior to this fix, the urlResolve method would automatically
strip the first segment of a path if the segment ends in a colon.
This was to correct undesired behavior in the $location service
using the file protocol on windows in multiple browsers (see #4680).

However, there could be cases where users intentionally
have first path segments that end in a colon
(although this conflicts with section 3.3 of rfc3986).

The solution to this problem is an extra check to make sure
the first path segment of the input url does not end with a colon,
to make sure we're only removing undesired path segments.

Fixes #4939

Prior to this fix, the urlResolve method would automatically
strip the first segment of a path if the segment ends in a colon.
This was to correct undesired behavior in the $location service
using the file protocol on windows in multiple browsers (see angular#4680).

However, there could be cases where users intentionally 
have first path segments that end in a colon 
(although this conflicts with section 3.3 of rfc3986).

The solution to this problem is an extra check to make sure
the first path segment of the input url does not end with a colon,
to make sure we're only removing undesired path segments.

Fixes angular#4939
@ghost ghost assigned tbosch Nov 13, 2013
@jeffbcross
Copy link
Contributor Author

CI job is pending.

@jeffbcross
Copy link
Contributor Author

@tbosch CI is happy.

@jeffbcross
Copy link
Contributor Author

Merged 89f435d

@jeffbcross jeffbcross closed this Nov 13, 2013
jeffbcross added a commit to jeffbcross/angular.js that referenced this pull request Nov 27, 2013
The urlResolve method was fixed to automatically remove the
volume label from path names to fix issues with the file
protocol on windows where $location.path() was returning
paths where the first segment would be the volume name,
such as "/C:/mypath". See angular#4942 and angular#4928

However, the solution was specific to the $location non-
HTML5 mode, and was implemented at a lower level of
abstraction than it should have been. This refactor moves
the fix to inside of the LocationHashBangUrl $$parse method.

Closes angular#5041
jeffbcross added a commit that referenced this pull request Nov 27, 2013
The urlResolve method was fixed to automatically remove the
volume label from path names to fix issues with the file
protocol on windows where $location.path() was returning
paths where the first segment would be the volume name,
such as "/C:/mypath". See #4942 and #4928

However, the solution was specific to the $location non-
HTML5 mode, and was implemented at a lower level of
abstraction than it should have been. This refactor moves
the fix to inside of the LocationHashBangUrl $$parse method.

Closes #5041
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
The urlResolve method was fixed to automatically remove the
volume label from path names to fix issues with the file
protocol on windows where $location.path() was returning
paths where the first segment would be the volume name,
such as "/C:/mypath". See angular#4942 and angular#4928

However, the solution was specific to the $location non-
HTML5 mode, and was implemented at a lower level of
abstraction than it should have been. This refactor moves
the fix to inside of the LocationHashBangUrl $$parse method.

Closes angular#5041
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
The urlResolve method was fixed to automatically remove the
volume label from path names to fix issues with the file
protocol on windows where $location.path() was returning
paths where the first segment would be the volume name,
such as "/C:/mypath". See angular#4942 and angular#4928

However, the solution was specific to the $location non-
HTML5 mode, and was implemented at a lower level of
abstraction than it should have been. This refactor moves
the fix to inside of the LocationHashBangUrl $$parse method.

Closes angular#5041
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

urlUtils should only strip path segments ending with colons IF the segment does not exist in the original URL.
2 participants