From 50f293d783156f7e0a609d3e5eb03af4bb20540b Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 23:01:28 -0500 Subject: [PATCH] Added better server address trimming. --- src/options.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/options.ts b/src/options.ts index eb0930b0..1ce1f05a 100644 --- a/src/options.ts +++ b/src/options.ts @@ -357,10 +357,10 @@ function activatePrivateTextChange(element: HTMLElement) { * @param input Input server address */ function validateServerAddress(input: string): string { - // Trim the last slash if needed - if (input.endsWith("/")) { - input = input.substring(0, input.length - 1); - } + input = input.trim(); + + // Trim the trailing slashes + input = input.replace(/\/+$/, ""); // If it isn't HTTP protocol if ((!input.startsWith("https://") && !input.startsWith("http://"))) {