Skip to content

Commit

Permalink
[Fix][MAIN-990][WRS-2251] Add trailing / in ENVIRONMENT_API sdk value
Browse files Browse the repository at this point in the history
  • Loading branch information
brapoprod committed Jan 13, 2025
1 parent a64407c commit fdbee3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/StudioProjectLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
UserInterfaceOutputSettings,
UserInterfaceWithOutputSettings,
} from './types/types';
import { getDownloadLink } from './utils/documentExportHelper';
import { getDownloadLink, addTrailingSlash } from './utils/documentExportHelper';
import { SESSION_USER_INTEFACE_ID_KEY } from './utils/constants';

export class StudioProjectLoader {
Expand Down Expand Up @@ -83,7 +83,7 @@ export class StudioProjectLoader {
public onProjectLoaded = (): void => {
window.StudioUISDK.configuration.setValue(
WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl,
this.graFxStudioEnvironmentApiBaseUrl,
addTrailingSlash(this.graFxStudioEnvironmentApiBaseUrl),
);
};

Expand Down
11 changes: 10 additions & 1 deletion src/utils/documentExportHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,13 @@ type ApiError = {
exceptionDetails?: string;
};

export default { getDownloadLink };
/**
* This method will check if a string has a trailing slash
* @param incomingUrl string to check
* @returns the string with a trailing slash
*/
export const addTrailingSlash = (incomingUrl: string): string => {
return incomingUrl.endsWith('/') ? incomingUrl : `${incomingUrl}/`;
};

export default { getDownloadLink, addTrailingSlash };

0 comments on commit fdbee3e

Please sign in to comment.