Skip to content

Commit 0179671

Browse files
committed
fix: tests
1 parent 3f4bfc5 commit 0179671

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/store/configureStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export function configureStore({
8686
listenForHistoryChange(store, history);
8787

8888
window.api = api;
89-
window.environment = environment;
9089

9190
return {history, store};
9291
}

src/types/window.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ interface Window {
3838
custom_backend?: string;
3939
meta_backend?: string;
4040
code_assist_backend?: string;
41-
environment?: string;
4241

4342
react_app_disable_checks?: boolean;
4443

src/utils/parseBalancer.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {environment} from '../store';
2+
13
import {normalizePathSlashes} from '.';
24

35
const protocolRegex = /^http[s]?:\/\//;
@@ -65,8 +67,16 @@ export function prepareBackendFromBalancer(rawBalancer: string) {
6567

6668
// Use meta_backend if it is defined to form backend url
6769
if (window.meta_backend) {
68-
const envPrefix = window.environment ? `/${window.environment}` : '';
69-
return normalizePathSlashes(`${envPrefix}/${window.meta_backend}/${preparedBalancer}`);
70+
const metaBackend = window.meta_backend;
71+
const envPrefix = environment ? `/${environment}` : '';
72+
73+
// If meta_backend is a full URL (has protocol), don't add leading slash
74+
if (protocolRegex.test(metaBackend)) {
75+
return normalizePathSlashes(`${metaBackend}/${preparedBalancer}`);
76+
}
77+
78+
// For relative meta_backend, include environment prefix
79+
return normalizePathSlashes(`${envPrefix}/${metaBackend}/${preparedBalancer}`);
7080
}
7181

7282
return preparedBalancer;

0 commit comments

Comments
 (0)