Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ deno task test
deno task build
```

Manual UI regression check for scan/clean results rendering:

1. Create a removable test file whose name includes `&` in the target game folder.
2. Add a `!rename` directive to `#keeplist.txt` whose `from` or `to` includes `<test>` text, for example `!rename folder/source.txt -> folder/<test>.txt`.
3. Run `Scan` so the file appears under `Files To Remove` and the directive appears under `Planned Renames`.
4. Confirm both sections render the special characters literally instead of interpreting them as HTML.

## Project Structure

- `main.ts` - desktop UI and command orchestration
Expand Down
12 changes: 10 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,14 @@ function setCleanReady(isReady) {
function markScanDirty() {
setCleanReady(false);
}
function escapeHtml(value) {
return String(value)
.replaceAll("&", "&amp;")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#39;");
}
function setResults(data) {
const el = document.getElementById("fileList");
const rows = [];
Expand All @@ -591,7 +599,7 @@ function setResults(data) {
if (renames.length === 0) {
rows.push(\`<div class="result-row result-empty">No renames planned</div>\`);
} else {
rows.push(...renames.map((rename) => \`<div class="result-row">\${rename.from} -> \${rename.to}</div>\`));
rows.push(...renames.map((rename) => \`<div class="result-row">\${escapeHtml(rename.from)} -> \${escapeHtml(rename.to)}</div>\`));
}
rows.push(\`</div></div>\`);

Expand All @@ -601,7 +609,7 @@ function setResults(data) {
if (removals.length === 0) {
rows.push(\`<div class="result-row result-empty">No files to remove</div>\`);
} else {
rows.push(...removals.map((file) => \`<div class="result-row">\${file}</div>\`));
rows.push(...removals.map((file) => \`<div class="result-row">\${escapeHtml(file)}</div>\`));
}
rows.push(\`</div></div>\`);

Expand Down