Handle channel names ending with a slash better
This commit is contained in:
parent
f03b30eff6
commit
0f5c3b57d2
8 changed files with 96 additions and 40 deletions
|
@ -66,13 +66,13 @@ func (h *wsHandler) init(r *http.Request) {
|
|||
h.session.numWS(), "WebSocket connections")
|
||||
|
||||
channels := h.session.user.GetChannels()
|
||||
path := r.URL.Query().Get("path")
|
||||
params := strings.Split(strings.Trim(path, "/"), "/")
|
||||
tabServer, tabChannel := parseTabCookie(r, path)
|
||||
path := r.URL.EscapedPath()[3:]
|
||||
pathServer, pathChannel := getTabFromPath(path)
|
||||
cookieServer, cookieChannel := parseTabCookie(r, path)
|
||||
|
||||
for _, channel := range channels {
|
||||
if (len(params) == 2 && channel.Server == params[0] && channel.Name == params[1]) ||
|
||||
(channel.Server == tabServer && channel.Name == tabChannel) {
|
||||
if (channel.Server == pathServer && channel.Name == pathChannel) ||
|
||||
(channel.Server == cookieServer && channel.Name == cookieChannel) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue