diff --git a/.changeset/sharp-years-drive.md b/.changeset/sharp-years-drive.md new file mode 100644 index 0000000000..39220e4d69 --- /dev/null +++ b/.changeset/sharp-years-drive.md @@ -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. diff --git a/plugins/search-backend-module-catalog/src/collators/DefaultCatalogCollatorFactory.ts b/plugins/search-backend-module-catalog/src/collators/DefaultCatalogCollatorFactory.ts index 1cef2e21df..f023efbf54 100644 --- a/plugins/search-backend-module-catalog/src/collators/DefaultCatalogCollatorFactory.ts +++ b/plugins/search-backend-module-catalog/src/collators/DefaultCatalogCollatorFactory.ts @@ -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), }), }; }