Fix $sanitize issue in the build logs view

This commit is contained in:
Joseph Schorr 2014-05-01 13:59:25 -04:00
parent bac3a4ba4f
commit bcc6caa9df

View file

@ -422,7 +422,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
builderService.getDescription = function(name, config) { builderService.getDescription = function(name, config) {
switch (name) { switch (name) {
case 'github': case 'github':
var source = $sanitize(UtilService.textToSafeHtml(config['build_source'])); var source = UtilService.textToSafeHtml(config['build_source']);
var desc = '<i class="fa fa-github fa-lg" style="margin-left: 2px; margin-right: 2px"></i> Push to Github Repository '; var desc = '<i class="fa fa-github fa-lg" style="margin-left: 2px; margin-right: 2px"></i> Push to Github Repository ';
desc += '<a href="https://github.com/' + source + '" target="_blank">' + source + '</a>'; desc += '<a href="https://github.com/' + source + '" target="_blank">' + source + '</a>';
desc += '<br>Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']); desc += '<br>Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
@ -1594,7 +1594,7 @@ quayApp.directive('entityReference', function () {
'entity': '=entity', 'entity': '=entity',
'namespace': '=namespace' 'namespace': '=namespace'
}, },
controller: function($scope, $element, UserService, $sanitize) { controller: function($scope, $element, UserService, UtilService) {
$scope.getIsAdmin = function(namespace) { $scope.getIsAdmin = function(namespace) {
return UserService.isNamespaceAdmin(namespace); return UserService.isNamespaceAdmin(namespace);
}; };
@ -1612,10 +1612,10 @@ quayApp.directive('entityReference', function () {
var org = UserService.getOrganization(namespace); var org = UserService.getOrganization(namespace);
if (!org) { if (!org) {
// This robot is owned by the user. // This robot is owned by the user.
return '/user/?tab=robots&showRobot=' + $sanitize(name); return '/user/?tab=robots&showRobot=' + UtilService.textToSafeHtml(name);
} }
return '/organization/' + org['name'] + '/admin?tab=robots&showRobot=' + $sanitize(name); return '/organization/' + org['name'] + '/admin?tab=robots&showRobot=' + UtilService.textToSafeHtml(name);
}; };
$scope.getPrefix = function(name) { $scope.getPrefix = function(name) {
@ -4110,7 +4110,7 @@ quayApp.directive('dockerfileCommand', function () {
scope: { scope: {
'command': '=command' 'command': '=command'
}, },
controller: function($scope, $element, $sanitize, Config) { controller: function($scope, $element, UtilService, Config) {
var registryHandlers = { var registryHandlers = {
'quay.io': function(pieces) { 'quay.io': function(pieces) {
var rnamespace = pieces[pieces.length - 2]; var rnamespace = pieces[pieces.length - 2];
@ -4147,11 +4147,11 @@ quayApp.directive('dockerfileCommand', function () {
$scope.getCommandTitleHtml = function(title) { $scope.getCommandTitleHtml = function(title) {
var space = title.indexOf(' '); var space = title.indexOf(' ');
if (space <= 0) { if (space <= 0) {
return $sanitize(title); return UtilService.textToSafeHtml(title);
} }
var kind = $scope.getCommandKind(title); var kind = $scope.getCommandKind(title);
var sanitized = $sanitize(title.substring(space + 1)); var sanitized = UtilService.textToSafeHtml(title.substring(space + 1));
var handler = kindHandlers[kind || '']; var handler = kindHandlers[kind || ''];
if (handler) { if (handler) {
@ -4176,7 +4176,7 @@ quayApp.directive('dockerfileView', function () {
scope: { scope: {
'contents': '=contents' 'contents': '=contents'
}, },
controller: function($scope, $element, $sanitize) { controller: function($scope, $element, UtilService) {
$scope.$watch('contents', function(contents) { $scope.$watch('contents', function(contents) {
$scope.lines = []; $scope.lines = [];
@ -4191,7 +4191,7 @@ quayApp.directive('dockerfileView', function () {
} }
var lineInfo = { var lineInfo = {
'text': $sanitize(line), 'text': UtilService.textToSafeHtml(line),
'kind': kind 'kind': kind
}; };
$scope.lines.push(lineInfo); $scope.lines.push(lineInfo);