Merge pull request #28365 from amintong/master

search-catalog add encodeURIComponent for location
This commit is contained in:
Fredrik Adelöw
2025-01-16 08:56:04 +01:00
committed by GitHub
2 changed files with 10 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-module-catalog': patch
---
Modified the logic for generating the location URL by encoding the entity property values with `encodeURIComponent`. This enhancement improves the safety and reliability of the URL.
@@ -120,9 +120,11 @@ export class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {
resourceRef: stringifyEntityRef(entity),
},
location: this.applyArgsToFormat(this.locationTemplate, {
namespace: entity.metadata.namespace || 'default',
kind: entity.kind,
name: entity.metadata.name,
namespace: encodeURIComponent(
entity.metadata.namespace || 'default',
),
kind: encodeURIComponent(entity.kind),
name: encodeURIComponent(entity.metadata.name),
}),
};
}