Fix tab cookie

This commit is contained in:
Ken-Håvard Lieng 2017-06-21 09:45:47 +02:00
parent 1c199f40e2
commit f7b80b413e
4 changed files with 27 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ export default function initialState({ store }) {
if (!store.getState().router.route) {
const tab = Cookie.get('tab');
if (tab) {
const [server, name = null] = tab.split('-');
const [server, name = null] = tab.split(/;(.+)/);
if (find(env.servers, srv => srv.host === server)) {
store.dispatch(select(server, name, true));

View File

@ -16,7 +16,7 @@ class Tab extends TabRecord {
toString() {
let str = this.server;
if (this.name) {
str += `-${this.name}`;
str += `;${this.name}`;
}
return str;
}

View File

@ -119,10 +119,13 @@ func parseTabCookie(r *http.Request, path string) (string, string) {
if path == "/" {
cookie, err := r.Cookie("tab")
if err == nil {
tab := strings.Split(cookie.Value, "-")
v, err := url.PathUnescape(cookie.Value)
if err == nil {
tab := strings.SplitN(v, ";", 2)
if len(tab) == 2 && isChannel(tab[1]) {
return tab[0], tab[1]
if len(tab) == 2 && isChannel(tab[1]) {
return tab[0], tab[1]
}
}
}
}