From f6c7a06a4167a0519f7807937e7494c450207deb Mon Sep 17 00:00:00 2001 From: Mikyo King Date: Thu, 14 Mar 2024 09:11:35 -0600 Subject: [PATCH] fix: sanitize base path --- app/src/RelayEnvironment.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/RelayEnvironment.ts b/app/src/RelayEnvironment.ts index 18fe0ef410..7db54cc96b 100644 --- a/app/src/RelayEnvironment.ts +++ b/app/src/RelayEnvironment.ts @@ -6,7 +6,10 @@ import { Store, } from "relay-runtime"; -const graphQLPath = window.Config.basename + "graphql"; +function getSanitizedPath(path: string): string { + return path.endsWith("/") ? path.slice(0, -1) : path; +} +const graphQLPath = getSanitizedPath(window.Config.basename) + "/graphql"; /** * Relay requires developers to configure a "fetch" function that tells Relay how to load * the results of GraphQL queries from your server (or other data source). See more at