diff --git a/index.html b/index.html
index 30b1112..26af6cb 100644
--- a/index.html
+++ b/index.html
@@ -472,7 +472,12 @@
Polished Crystal Save Patcher
if (oldSaveInput.files.length > 0) {
const file = oldSaveInput.files[0];
// Escape the file name to prevent XSS
- const sanitizedFileName = file.name.replace(//g, ">").replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'");
+ const sanitizedFileName = file.name
+ .replace(/&/g, "&") // Replace '&' first to prevent double-escaping
+ .replace(//g, ">")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
dropZone.querySelector('p').textContent = 'Selected file: ' + file.name;
fileDetails.innerHTML = `
File Name: ${sanitizedFileName}