mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Ensure we add 'http://' to URLs even when a username is used.
This commit is contained in:
parent
9209b923c7
commit
21b4ebe9e4
2 changed files with 11 additions and 4 deletions
|
@ -67,9 +67,17 @@ module.exports = syrup.serial()
|
||||||
.then(updateBrowsers)
|
.then(updateBrowsers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureHttpProtocol(url) {
|
||||||
|
// Check for '://' because a protocol-less URL might include
|
||||||
|
// a username:password combination.
|
||||||
|
return (url.indexOf('://') === -1 ? 'http://' : '') + url
|
||||||
|
}
|
||||||
|
|
||||||
service.on('browserPackageChange', updateBrowsers)
|
service.on('browserPackageChange', updateBrowsers)
|
||||||
|
|
||||||
router.on(wire.BrowserOpenMessage, function(channel, message) {
|
router.on(wire.BrowserOpenMessage, function(channel, message) {
|
||||||
|
message.url = ensureHttpProtocol(message.url)
|
||||||
|
|
||||||
if (message.browser) {
|
if (message.browser) {
|
||||||
log.info('Opening "%s" in "%s"', message.url, message.browser)
|
log.info('Opening "%s" in "%s"', message.url, message.browser)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,9 @@ module.exports = function NavigationCtrl($scope, $rootScope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addHttp(textUrl) {
|
function addHttp(textUrl) {
|
||||||
if (textUrl.indexOf(':') === -1 && textUrl.indexOf('.') !== -1) {
|
// Check for '://' because a protocol-less URL might include
|
||||||
return 'http://' + textUrl
|
// a username:password combination.
|
||||||
}
|
return (textUrl.indexOf('://') === -1 ? 'http://' : '') + textUrl
|
||||||
return textUrl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.blurUrl = false
|
$scope.blurUrl = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue