Permalink
Browse files

网页连接主机 js regx bug #292

ws://jumpserver.com/ws/terminal?id=1&role=admin,?id=1&role=admin
而期望的结果应该是ws://jumpserver.com/ws/terminal?id=1&role=admin
所以document.URL.match(/(\?.*)/)里的正则表达式应该去掉分组,变为 document.URL.match(/\?.*/)
  • Loading branch information...
1 parent 0ad2625 commit 547408222d1c69aaa70dd2586047bdd2598619ce @jiaxiangkong jiaxiangkong committed on GitHub Nov 9, 2016
Showing with 2 additions and 2 deletions.
  1. +2 −2 static/js/webterminal.js
@@ -13,7 +13,7 @@ WSSHClient.prototype._generateEndpoint = function (options) {
var protocol = 'ws://';
}
- var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/terminal' + document.URL.match(/(\?.*)/);
+ var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/terminal' + document.URL.match(/\?.*/);
return endpoint;
};
WSSHClient.prototype.connect = function (options) {
@@ -151,4 +151,4 @@ $(document).ready(function () {
$(".terminal").mouseenter(function () {
$(".termChangBar").slideUp();
})
-});
+});

0 comments on commit 5474082

Please sign in to comment.