Ensure we add 'http://' to URLs even when a username is used.

This commit is contained in:
Simo Kinnunen
2015-02-06 12:23:12 +09:00
parent 9209b923c7
commit 21b4ebe9e4
2 changed files with 11 additions and 4 deletions

View File

@@ -24,10 +24,9 @@ module.exports = function NavigationCtrl($scope, $rootScope) {
}
function addHttp(textUrl) {
if (textUrl.indexOf(':') === -1 && textUrl.indexOf('.') !== -1) {
return 'http://' + textUrl
}
return textUrl
// Check for '://' because a protocol-less URL might include
// a username:password combination.
return (textUrl.indexOf('://') === -1 ? 'http://' : '') + textUrl
}
$scope.blurUrl = false