Skip to content

Commit

Permalink
Merge branch 'main' into issue-OWASP-BLT#1337
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieBLT authored Nov 2, 2023
2 parents 96746d3 + 0ffb73a commit 2020603
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
11 changes: 10 additions & 1 deletion website/static/vendor/jquery/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -5700,7 +5700,16 @@

jQuery.extend({
htmlPrefilter: function (html) {
var expandedHTML = html.replace(rxhtmlTag, "<$1></$2>");
var safeTagsToExpand = /<([a-z]+)([^<]*)\/>/gi;
var expandedHTML = html.replace(safeTagsToExpand, function(match, tag, attributes) {
// Check if the tag is one that should never be self-closing
if (!/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(tag)) {
return "<" + tag + attributes + "></" + tag + ">";
} else {
// If it's a self-closing tag, leave it as is
return match;
}
});
return sanitizeHTML(expandedHTML);
},

Expand Down
19 changes: 11 additions & 8 deletions website/templates/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,17 @@ <h2 class="text-2xl font-semibold leading-7 text-gray-900">

fileList.map(file => {
let src = URL.createObjectURL(file);
$("#files_manage").append(`
<div class="w-full md:w-[300px] h-[180px] overflow-hidden rounded-lg" onclick="previewFile('${file.name}')">
<div class="w-full h-10 flex justify-center rounded-t-lg p-2 bg-gray-500">
<p class="text-xl text-white font-bold">${file.name.slice(0,20)}...</p>
</div>
<img class="object-cover" src="${src}" alt="">
</div>
`)
let safeName = $("<div>").text(file.name).html();
let safeNameDisplay = safeName.slice(0, 20) + (safeName.length > 20 ? "..." : "");
// Use the safe name for display and in the onclick handler
let fileDiv = $("<div>").addClass("w-full md:w-[300px] h-[180px] overflow-hidden rounded-lg").attr("onclick", `previewFile('${safeName}')`);
let titleDiv = $("<div>").addClass("w-full h-10 flex justify-center rounded-t-lg p-2 bg-gray-500");
let titleP = $("<p>").addClass("text-xl text-white font-bold").text(safeNameDisplay);
let img = $("<img>").addClass("object-cover").attr("src", escapeHtml(src));

titleDiv.append(titleP);
fileDiv.append(titleDiv).append(img);
$("#files_manage").append(fileDiv);
})

});
Expand Down

0 comments on commit 2020603

Please sign in to comment.