From eee8d76a4ff118da7a1fe0223d58d280b5a17335 Mon Sep 17 00:00:00 2001 From: tong min Date: Sun, 5 Jan 2025 03:28:05 +0000 Subject: [PATCH 1/2] udpate plugins search-backend-module-catalog encoding the entity property values with encodeURIComponent for location Signed-off-by: tong min --- .changeset/sharp-years-drive.md | 5 +++++ .../src/collators/DefaultCatalogCollatorFactory.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/sharp-years-drive.md 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), }), }; } From d0b993dbea223697dacb06089e51fa2e56659958 Mon Sep 17 00:00:00 2001 From: tong min Date: Mon, 6 Jan 2025 10:38:21 +0800 Subject: [PATCH 2/2] Update .changeset/sharp-years-drive.md Co-authored-by: Yasser Hennawi Signed-off-by: tong min --- .changeset/sharp-years-drive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/sharp-years-drive.md b/.changeset/sharp-years-drive.md index 39220e4d69..92ade2b972 100644 --- a/.changeset/sharp-years-drive.md +++ b/.changeset/sharp-years-drive.md @@ -2,4 +2,4 @@ '@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. +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.