Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix code scanning alert no. 1: DOM text reinterpreted as HTML
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
Ohswedd and github-advanced-security[bot] authored Nov 30, 2024
commit a0597d2e69b6c4f31a7754ccf2975a3804d4eaeb
11 changes: 7 additions & 4 deletions src/js/components/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ function initializeKromaFileUploadComponents() {
function appendFileToList(file, listContainer) {
const listItem = document.createElement('div');
listItem.className = 'kroma-file-upload-list-item';
listItem.innerHTML = `
<span>${file.name}</span>
<button aria-label="Remove file">&times;</button>
`;
const fileNameSpan = document.createElement('span');
fileNameSpan.textContent = file.name;
const removeButton = document.createElement('button');
removeButton.setAttribute('aria-label', 'Remove file');
removeButton.textContent = '×';
listItem.appendChild(fileNameSpan);
listItem.appendChild(removeButton);
// Handle remove file
listItem.querySelector('button').addEventListener('click', () => {
listItem.remove();
Expand Down