From 5a8949d595d63de827179cb2fddb8dd803026e3a Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 13 Jun 2026 11:15:20 +0000 Subject: [PATCH] vjoins --- copyparty/httpcli.py | 3 ++- copyparty/u2idx.py | 3 ++- copyparty/up2k.py | 3 ++- copyparty/util.py | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 246545fc..ddb22441 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -123,6 +123,7 @@ from .util import ( unescape_cookie, unquotep, vjoin, + vjoins, vol_san, vroots, vsplit, @@ -1919,7 +1920,7 @@ class HttpCli(object): df = {} fgen = itertools.chain([topdir], fgen) - vtop = vjoin(self.args.R, vjoin(vn.vpath, rem)) + vtop = vjoins(self.args.R, vn.vpath, rem) chunksz = 0x7FF8 # preferred by nginx or cf (dunno which) diff --git a/copyparty/u2idx.py b/copyparty/u2idx.py index ca1014d1..67c9967a 100644 --- a/copyparty/u2idx.py +++ b/copyparty/u2idx.py @@ -22,6 +22,7 @@ from .util import ( quotep, s3dec, vjoin, + vjoins, ) if HAVE_SQLITE3: @@ -437,7 +438,7 @@ class U2idx(object): if rd.startswith("//") or fn.startswith("//"): rd, fn = s3dec(rd, fn) - vp = vjoin(vjoin(vtop, rd), fn) + vp = vjoins(vtop, rd, fn) if vp in seen_rps: continue diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 18e2e404..f1874ba9 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -70,6 +70,7 @@ from .util import ( ub64enc, unhumanize, vjoin, + vjoins, vsplit, w8b64dec, w8b64enc, @@ -3190,7 +3191,7 @@ class Up2k(object): c2 = None for cur, dp_dir, dp_fn in lost: t = "forgetting desynced db entry: %r" - self.log(t % ("/" + vjoin(vjoin(vfs.vpath, dp_dir), dp_fn))) + self.log(t % ("/" + vjoins(vfs.vpath, dp_dir, dp_fn))) self.db_rm(cur, vfs.flags, dp_dir, dp_fn, cj["size"]) if c2 and c2 != cur: c2.connection.commit() diff --git a/copyparty/util.py b/copyparty/util.py index 9da36b8e..bc661644 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -2679,6 +2679,10 @@ def vjoin(rd: str, fn: str) -> str: return rd or fn +def vjoins(*a: str) -> str: + return "/".join([x for x in a if x]) + + # url-join def ujoin(rd: str, fn: str) -> str: if rd and fn: