-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ngRoute breaks with file:// protocol in 1.2.0-rc.3 #4680
Comments
Correction and furher explanation: |
I have been able to replicate this using the code that follows, and it would seem that there is a problem with routing or browser location. The code doesn't request the template through http as it is embedded in a script tag, so the Saving the code as Changing @szwacz AFAIK node-webkit has a different security model so <!DOCTYPE HTML>
<html ng-app="app">
<head>
<script src="http://code.angularjs.org/snapshot/angular.js"></script>
<script src="http://code.angularjs.org/snapshot/angular-route.js"></script>
<script>
angular.module('app', ['ngRoute'])
.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'root.html'
});
});
</script>
<script id="root.html" type="text/ng-template">
<p>Hello!</p>
</script>
</head>
<body>
<ng-view></ng-view>
</body>
</html> |
Hi. Regards. |
For me, it appears with Chrome on Windows - but not on MacOSX. Especially with with node-webkit. |
Chrome on Windows here too. |
In fact it's not really cause of Angular... Create a small document
In chrome result is : "/C:/" FF and IE implementations considere the drive letter as "the host" and remove it from pathname As the routing is done with the pathname.... bug is here :) Hack is easy to put in the function urlResolve(url) ... but little bit hungly... I'm under Windows... |
Chrome and other browsers on Windows often append the drive name to the pathname, as described in angular#4680. This would cause the location service to browse to odd URLs, such as /C:/myfile.html, when opening apps using file://. Fixes angular#4680
@sebastienroul and I have submitted a fix for this, but before merging into master, I'd appreciate if folks could try this build of angular in your apps to make sure it solves the problem for you: |
@jeffbcross the build you refer to solves the problem for me for the example I gave in my earlier comment. Thanks go out to you and @sebastienroul. |
Merged: a0932ae Thanks for all the help identifying the problem and helping to fix it! |
Chrome and other browsers on Windows often append the drive name to the pathname, as described in angular#4680. This would cause the location service to browse to odd URLs, such as /C:/myfile.html, when opening apps using file://. Fixes angular#4680
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
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
Chrome and other browsers on Windows often append the drive name to the pathname, as described in angular#4680. This would cause the location service to browse to odd URLs, such as /C:/myfile.html, when opening apps using file://. Fixes angular#4680
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
Chrome and other browsers on Windows often append the drive name to the pathname, as described in angular#4680. This would cause the location service to browse to odd URLs, such as /C:/myfile.html, when opening apps using file://. Fixes angular#4680
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
Hello.
Here is code to reproduce the issue.
Download it, and launch locally index.html. Problem occurs only with
file://
protocol.Symptoms:
On Chrome, Opera and IE the view will not load. No error visible in console.
On Firefox for some reason this problem doesn't occur, everything works as expected.
Angular 1.2.0-rc.2 was free of this issue.
The text was updated successfully, but these errors were encountered: