From 6a217d7388fcd6d785a09626ab9ac3d9134d06f9 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 6 May 2018 13:45:19 +0800 Subject: [PATCH] html: check trailing slash on pathname for ws url Fixes #100 --- html/js/app.js | 3 ++- src/index.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/html/js/app.js b/html/js/app.js index 605c0d2..e80ec1d 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -171,7 +171,8 @@ function handleReceive(zsession) { var terminalContainer = document.getElementById('terminal-container'), httpsEnabled = window.location.protocol === 'https:', - url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws', + url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + + (window.location.pathname.endsWith('/') ? '' : '/') + 'ws', textDecoder = new TextDecoder(), textEncoder = new TextEncoder(), authToken = (typeof tty_auth_token !== 'undefined') ? tty_auth_token : null, diff --git a/src/index.html b/src/index.html index ba27e62..e026a96 100644 --- a/src/index.html +++ b/src/index.html @@ -41,5 +41,5 @@ - + -- 2.43.4