Merge pull request #2319 from coreos-inc/FIX-escapehtmlstring-type-error

fix(js/util-service): ensure text is a string
This commit is contained in:
Erica 2017-02-02 13:18:26 -05:00 committed by GitHub
commit 0150abc488

View file

@ -75,7 +75,8 @@ angular.module('quay').factory('UtilService', ['$sanitize', function($sanitize)
}; };
utilService.escapeHtmlString = function(text) { utilService.escapeHtmlString = function(text) {
var adjusted = text.replace(/&/g, "&") var textStr = (text || '').toString();
var adjusted = textStr.replace(/&/g, "&")
.replace(/</g, "&lt;") .replace(/</g, "&lt;")
.replace(/>/g, "&gt;") .replace(/>/g, "&gt;")
.replace(/"/g, "&quot;") .replace(/"/g, "&quot;")