From c9caac916cd4fdd2ed482524d96518765db2e1b8 Mon Sep 17 00:00:00 2001 From: Mike Urbanski Date: Wed, 2 Oct 2024 13:42:25 -0500 Subject: [PATCH 1/2] trim trailing slash in prisma API URL --- src/config/configUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config/configUtils.ts b/src/config/configUtils.ts index 61b7d64..4b83a33 100644 --- a/src/config/configUtils.ts +++ b/src/config/configUtils.ts @@ -27,7 +27,10 @@ export const getToken = (): string | undefined => { }; export const getPrismaApiUrl = (): string | undefined => { - const prismaURL = CONFIG.userConfig[USER_CONFIGURATION_PARAM.PRISMA_URL]; + let prismaURL: string = CONFIG.userConfig[USER_CONFIGURATION_PARAM.PRISMA_URL]; + if (prismaURL.endsWith('/')) { + prismaURL = prismaURL.substring(0, prismaURL.length - 1); + } return prismaURL; }; From b890143a8dfe915398eb9c03d94fef219c40611a Mon Sep 17 00:00:00 2001 From: Mike Urbanski Date: Wed, 2 Oct 2024 13:45:18 -0500 Subject: [PATCH 2/2] handle undefined --- src/config/configUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/configUtils.ts b/src/config/configUtils.ts index 4b83a33..1238cb5 100644 --- a/src/config/configUtils.ts +++ b/src/config/configUtils.ts @@ -28,7 +28,7 @@ export const getToken = (): string | undefined => { export const getPrismaApiUrl = (): string | undefined => { let prismaURL: string = CONFIG.userConfig[USER_CONFIGURATION_PARAM.PRISMA_URL]; - if (prismaURL.endsWith('/')) { + if (prismaURL?.endsWith('/')) { prismaURL = prismaURL.substring(0, prismaURL.length - 1); } return prismaURL;