From 4ee81af8f6d4cce67d32c9eee41fe503091afdc2 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 6 May 2023 18:54:55 +0000 Subject: [PATCH] support ';' in passwords --- copyparty/httpcli.py | 2 +- copyparty/util.py | 4 ++-- copyparty/web/util.js | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 1efab5c0..624de1f9 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -331,7 +331,7 @@ class HttpCli(object): for k in arglist.split("&"): if "=" in k: k, zs = k.split("=", 1) - uparam[k.lower()] = zs.strip() + uparam[k.lower()] = unquotep(zs.strip().replace("+", " ")) else: uparam[k.lower()] = "" diff --git a/copyparty/util.py b/copyparty/util.py index 5247a70e..aae2a0f6 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1593,7 +1593,7 @@ def gen_filekey_dbg( def gencookie(k: str, v: str, r: str, tls: bool, dur: Optional[int]) -> str: - v = v.replace(";", "") + v = v.replace("%", "%25").replace(";", "%3B") if dur: exp = formatdate(time.time() + dur, usegmt=True) else: @@ -2320,7 +2320,7 @@ def unescape_cookie(orig: str) -> str: ret += chr(int(esc[1:], 16)) except: ret += esc - esc = "" + esc = "" else: ret += ch diff --git a/copyparty/web/util.js b/copyparty/web/util.js index c8fda0d0..de1c5193 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -742,7 +742,7 @@ function get_pwd() { if (pwd.length < 2) return null; - return pwd[1].split(';')[0]; + return decodeURIComponent(pwd[1].split(';')[0]); } @@ -1769,7 +1769,6 @@ function cprop(name) { function bchrome() { - console.log(document.documentElement.className); var v, o = QS('meta[name=theme-color]'); if (!o) return;