fix: prevent duplicate path keys in entity search by ignoring case

Signed-off-by: Kuldeep Parihar <kldpsingh916@gmail.com>
This commit is contained in:
Kuldeep Parihar
2025-02-27 22:01:11 +05:30
parent a852584066
commit 43063031d3
2 changed files with 15 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Added a fix in `@backstage/plugin-catalog-backend` to prevent duplicate path keys in entity search if only casing is different.
@@ -110,7 +110,16 @@ export function traverse(root: unknown): Kv[] {
// because the latter means EITHER b or c has to be present.
visit(path, item);
if (typeof item === 'string') {
output.push({ key: `${path}.${item}`, value: true });
const pathKey = `${path}.${item}`;
if (
!output.some(
kv =>
kv.key.toLocaleLowerCase('en-US') ===
pathKey.toLocaleLowerCase('en-US'),
)
) {
output.push({ key: pathKey, value: true });
}
}
}
return;