Skip to content

Commit

Permalink
CodeQL Fix 1
Browse files Browse the repository at this point in the history
DOM text reinterpreted as HTML
  • Loading branch information
slominskir committed Aug 7, 2024
1 parent 1ca96d2 commit e9ed28c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/main/webapp/resources/js/workmap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
/**
* Global String Enhancements
*/
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function (str) {
return this.indexOf(str) === 0;
};
}
if (!String.prototype.encodeXml) {
String.prototype.encodeXml = function () {
return this.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&apos;')
.replace(/"/g, '&quot;');
};
}
if (!String.prototype.decodeXml) {
String.prototype.decodeXml = function () {
return this.replace(/&quot;/g, '"')
.replace(/&apos;/g, '\'')
.replace(/&gt;/g, '>')
.replace(/&lt;/g, '<')
.replace(/&amp;/g, '&');
};
}

var jlab = jlab || {};

jlab.su = function(url) {
Expand Down Expand Up @@ -46,7 +73,7 @@ $(document).ready(function() {
buttonImageOnly: true,
onSelect: function(dateText, inst) {
/*window.location.href=$('#contextPath').val() + '/view-work-map?yearMonthDay=' + dateText;*/
window.location.href = $('#contextPath').val() + '/' + dateText;
window.location.href = String($('#contextPath').val() + '/' + dateText).encodeXml();
},
beforeShow: function() {
$('#ui-datepicker-div').addClass('top-of-the-world');
Expand Down

0 comments on commit e9ed28c

Please sign in to comment.