Skip to content

Commit

Permalink
Strip trailing any / from serverUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodearnest committed Oct 17, 2023
1 parent fe92036 commit a85fa60
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sacro-app/src/create-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const { waitThenLoad } = require("./utils");

let TEMPDIR = null;

function rtrim(x, characters) {
let 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;
Expand All @@ -21,6 +29,8 @@ const createWindow = async () => {
serverProcess = server;
}

serverUrl = rtrim(serverUrl, "/");

console.log(`Using ${serverUrl} as backend`);

// handle downloads
Expand Down

0 comments on commit a85fa60

Please sign in to comment.