From 14695a8f0e5f8be3ae42a5a3653b28acd76df4a9 Mon Sep 17 00:00:00 2001 From: Marco Dalalba Date: Wed, 3 Dec 2025 09:34:21 -0300 Subject: [PATCH] refactor/bugfix: simplify hasOpenHandsSuffix with provider lookup for gitlab/azure (#11877) Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com> --- frontend/src/utils/utils.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts index 620fb2c444..69ff7aae5f 100644 --- a/frontend/src/utils/utils.ts +++ b/frontend/src/utils/utils.ts @@ -606,10 +606,15 @@ export const shouldIncludeRepository = ( * @returns The query string for searching OpenHands repositories */ export const getOpenHandsQuery = (provider: Provider | null): string => { - if (provider === "gitlab") { - return "openhands-config"; - } - return ".openhands"; + const providerRepositorySuffix: Record = { + gitlab: "openhands-config", + azure_devops: "openhands-config", + default: ".openhands", + } as const; + + return provider && provider in providerRepositorySuffix + ? providerRepositorySuffix[provider] + : providerRepositorySuffix.default; }; /** @@ -621,12 +626,7 @@ export const getOpenHandsQuery = (provider: Provider | null): string => { export const hasOpenHandsSuffix = ( repo: GitRepository, provider: Provider | null, -): boolean => { - if (provider === "gitlab") { - return repo.full_name.endsWith("/openhands-config"); - } - return repo.full_name.endsWith("/.openhands"); -}; +): boolean => repo.full_name.endsWith(`/${getOpenHandsQuery(provider)}`); /** * Build headers for V1 API requests that require session authentication