Skip to content

Commit 0936343

Browse files
Potential fix for code scanning alert no. 4: Incomplete multi-character sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Miccy <code@miccy.dev>
1 parent af67b9a commit 0936343

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

apps/web/src/mdx/searchIndex.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ const data = "DATA_PLACEHOLDER";
1919
*/
2020
const getName = (title) => {
2121
let t = title.toLowerCase();
22-
// Remove generic parameters like <T, E>
23-
t = t.replace(/<[^>]*>/g, "");
22+
// Remove trailing generic parameters like <T, E> from type names
23+
// e.g., "evolu<s>" -> "evolu", "interface: foo<t, e>" -> "interface: foo"
24+
t = t.replace(/\s*<[^>]*>$/, "");
2425
// Get the part after last colon or slash
2526
const parts = t.split(/[:/]/);
2627
return parts[parts.length - 1].trim();

0 commit comments

Comments
 (0)