Skip to content

Commit a117a1a

Browse files
committed
chore: remove regex stripping trailing slash from configured url
1 parent 34fd9c9 commit a117a1a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/delegation-toolkit/src/experimental/delegationStorage.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@ export class DelegationStorageClient {
5353
#apiUrl: string;
5454

5555
constructor(config: DelegationStorageConfig) {
56-
let apiUrl = config.environment.apiUrl.replace(/\/+$/u, ''); // Remove trailing slashes
56+
const apiUrl = config.environment.apiUrl;
57+
5758
if (!apiUrl.endsWith(this.#apiVersionPrefix)) {
58-
apiUrl = `${apiUrl}/${this.#apiVersionPrefix}`;
59+
const separator = apiUrl.endsWith('/') ? '' : '/';
60+
this.#apiUrl = `${apiUrl}${separator}${this.#apiVersionPrefix}`;
61+
} else {
62+
this.#apiUrl = apiUrl;
5963
}
6064
this.#fetcher = this.#initializeFetcher(config);
6165
this.#config = config;
62-
this.#apiUrl = apiUrl;
6366
}
6467

6568
/**

0 commit comments

Comments
 (0)