From 3eb7b46d838a4edb942d011cba597884d0315dab Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 6 Aug 2026 21:08:34 +0000 Subject: [PATCH] optimize --- copyparty/httpcli.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 79c72b21..2a61b2c5 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -7445,20 +7445,18 @@ class HttpCli(object): dirs = [] files = [] ptn_hr = RE_HR - use_abs_url = is_opds or ( - vpath and not is_ls and not is_js and not self.trailing_slash - ) + + base = "" + if is_opds or (vpath and not (is_ls or is_js or self.trailing_slash)): + if is_opds: + base = self.args.SRS + if vpath: + base += vpath + "/" + else: + base = "/" + vpath + "/" + for fn in ls_names: - base = "" - href = fn - if use_abs_url: - if is_opds: - base = self.args.SRS - if vpath: - base += vpath + "/" - else: - base = "/" + vpath + "/" - href = base + fn + href = base + fn if fn in vfs_virt: fspath = vfs_virt[fn].realpath