Added better server address trimming.

This commit is contained in:
Ajay Ramachandran 2020-02-08 23:01:28 -05:00
parent 2b558c43bd
commit 50f293d783

View file

@ -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://"))) {