From f8df253261105d5139b5961fc8ecdcb5670188e3 Mon Sep 17 00:00:00 2001 From: "Camgoz, Fatih" Date: Fri, 16 May 2025 13:39:50 -0400 Subject: [PATCH] Update isCloud method to resolve Incomplete URL substring sanitization error Signed-off-by: Camgoz, Fatih --- .changeset/wise-teeth-study.md | 16 +++++++++++++--- .../src/lib/azure.ts | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.changeset/wise-teeth-study.md b/.changeset/wise-teeth-study.md index a0ee07cc60..b7f32fbb02 100644 --- a/.changeset/wise-teeth-study.md +++ b/.changeset/wise-teeth-study.md @@ -2,9 +2,19 @@ '@backstage/plugin-catalog-backend-module-azure': minor --- -isCloud function now also checks if hostname endswith visualstudio.com along with dev.azure.com - +isCloud function now also checks if hostname is visualstudio.com or endswith visualstudio.com along with dev.azure.com +git s ```diff - const isCloud = (host: string) => host === 'dev.azure.com'; -+ const isCloud = (host: string) => host === 'dev.azure.com' || host.endsWith('visualstudio.com'); ++ const isCloud = (host: string) => { ++ if (host === 'dev.azure.com') { ++ return true; ++ } + ++ if (host === 'visualstudio.com' || host.endsWith('.visualstudio.com')) { ++ return true; ++ } + ++ return false; ++ }; ``` diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.ts b/plugins/catalog-backend-module-azure/src/lib/azure.ts index daaf2b5678..5c68494f13 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.ts @@ -46,8 +46,18 @@ interface CodeSearchRequest { }; } -const isCloud = (host: string) => - host === 'dev.azure.com' || host.endsWith('visualstudio.com'); +const isCloud = (host: string) => { + if (host === 'dev.azure.com') { + return true; + } + + if (host === 'visualstudio.com' || host.endsWith('.visualstudio.com')) { + return true; + } + + return false; +}; + const PAGE_SIZE = 1000; // codeSearch returns all files that matches the given search path.