fix(js/util-service): ensure text is a string

This commit is contained in:
EvB 2017-01-30 14:10:20 -05:00
parent 8a842d286f
commit 30214a794b

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;")