From: Shuanglei Tao Date: Sun, 6 May 2018 05:45:19 +0000 (+0800) Subject: html: check trailing slash on pathname for ws url X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=6a217d7388fcd6d785a09626ab9ac3d9134d06f9;p=ttyd.git html: check trailing slash on pathname for ws url Fixes #100 --- 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 @@ - +