fixed Azure DevOps ADR file path

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
Deepankumar Loganathan
2024-02-15 21:04:09 +01:00
parent ecf1a6d91e
commit 61f7a1911b
@@ -45,8 +45,18 @@ export const AdrReader = (props: {
const scmIntegrations = useApi(scmIntegrationsApiRef);
const adrApi = useApi(adrApiRef);
const adrLocationUrl = getAdrLocationUrl(entity, scmIntegrations);
let url = `${adrLocationUrl.replace(/\/$/, '')}`;
const adrUrlPath = url.match(/path=\/.*\&/);
if (adrUrlPath) {
// Azure DevOps SCM handle the path in URL Params
const adrPath = adrUrlPath![0].replace(/\&$/, '');
const regex = new RegExp(`${adrPath}`);
url = url.replace(regex, `${adrPath}/${adr}}`);
} else {
// Other SCM tools
url = `${url}/${adr}`;
}
const url = `${adrLocationUrl.replace(/\/$/, '')}/${adr}`;
const { value, loading, error } = useAsync(
async () => adrApi.readAdr(url),
[url],