Spaces:
Sleeping
Sleeping
Commit ·
7e3b7e5
1
Parent(s): e055b14
fix(C-01,H-03): pre-fill search input with current query; sanitize entity id in not-found message (XSS)
Browse files- frontend/js/app.js +6 -1
frontend/js/app.js
CHANGED
|
@@ -300,6 +300,11 @@ const Views = {
|
|
| 300 |
</div>
|
| 301 |
`;
|
| 302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
document.getElementById("search-btn").addEventListener("click", () => {
|
| 304 |
const q = document.getElementById("search-input").value.trim();
|
| 305 |
if (q) Router.navigate(`/search?q=${encodeURIComponent(q)}`);
|
|
@@ -416,7 +421,7 @@ const Views = {
|
|
| 416 |
if (!profile && !risk) {
|
| 417 |
container.innerHTML = `
|
| 418 |
<div style="text-align:center;padding:var(--space-16);color:var(--text-muted)">
|
| 419 |
-
Entity not found: ${id}
|
| 420 |
</div>
|
| 421 |
`;
|
| 422 |
return;
|
|
|
|
| 300 |
</div>
|
| 301 |
`;
|
| 302 |
|
| 303 |
+
// C-01 FIX: pre-fill the search input with the current query
|
| 304 |
+
// so users can see what they searched and edit it
|
| 305 |
+
const _searchInput = document.getElementById("search-input");
|
| 306 |
+
if (_searchInput && query) _searchInput.value = query;
|
| 307 |
+
|
| 308 |
document.getElementById("search-btn").addEventListener("click", () => {
|
| 309 |
const q = document.getElementById("search-input").value.trim();
|
| 310 |
if (q) Router.navigate(`/search?q=${encodeURIComponent(q)}`);
|
|
|
|
| 421 |
if (!profile && !risk) {
|
| 422 |
container.innerHTML = `
|
| 423 |
<div style="text-align:center;padding:var(--space-16);color:var(--text-muted)">
|
| 424 |
+
Entity not found: ${sanitize(id)}
|
| 425 |
</div>
|
| 426 |
`;
|
| 427 |
return;
|