Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,24 @@ <h3>Testing Without Real Invoices</h3>

if (file) {
const sizeMB = (file.size / 1024 / 1024).toFixed(2);
fileInfo.innerHTML = `📄 ${file.name} (${sizeMB} MB)`;
// Safely update fileInfo with separate text nodes to prevent HTML injection
fileInfo.textContent = ""; // Clear previous content
// Create emoji node
const emojiNode = document.createTextNode("📄 ");
// Create file name node
const fileNameNode = document.createTextNode(file.name);
// Create file size node
const fileSizeNode = document.createTextNode(` (${sizeMB} MB)`);
fileInfo.appendChild(emojiNode);
fileInfo.appendChild(fileNameNode);
fileInfo.appendChild(fileSizeNode);
fileInfo.style.display = 'block';

if (file.size > 10 * 1024 * 1024) {
fileInfo.innerHTML += ' <span style="color: red;">⚠️ File too large (max 10MB)</span>';
const warningSpan = document.createElement('span');
warningSpan.style.color = 'red';
warningSpan.textContent = ' ⚠️ File too large (max 10MB)';
fileInfo.appendChild(warningSpan);
}
} else {
fileInfo.style.display = 'none';
Expand Down