From b705e7892892e19095929f8b5240623f369d3cab Mon Sep 17 00:00:00 2001 From: Simon Davy Date: Tue, 17 Oct 2023 16:10:53 +0100 Subject: [PATCH] Strip trailing any / from serverUrl --- sacro-app/src/create-window.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sacro-app/src/create-window.js b/sacro-app/src/create-window.js index d316189..4029032 100644 --- a/sacro-app/src/create-window.js +++ b/sacro-app/src/create-window.js @@ -11,6 +11,15 @@ const { waitThenLoad } = require("./utils"); let TEMPDIR = null; +function rtrim(x, characters) { + var start = 0; + var end = x.length - 1; + while (characters.indexOf(x[end]) >= 0) { + end -= 1; + } + return x.substr(0, end + 1); +} + const createWindow = async () => { let serverUrl = process.env.SACRO_URL; let serverProcess = null; @@ -21,6 +30,9 @@ const createWindow = async () => { serverProcess = server; } + serverUrl = rtrim(serverUrl, '/') + + console.log(`Using ${serverUrl} as backend`); // handle downloads