mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
also sanitize histpaths in client error messages;
previously it only did volume abspaths
This commit is contained in:
parent
14bccbe45f
commit
0f386c4b08
|
@ -1245,12 +1245,20 @@ def log_thrs(log: Callable[[str, str, int], None], ival: float, name: str) -> No
|
||||||
|
|
||||||
|
|
||||||
def vol_san(vols: list["VFS"], txt: bytes) -> bytes:
|
def vol_san(vols: list["VFS"], txt: bytes) -> bytes:
|
||||||
|
txt0 = txt
|
||||||
for vol in vols:
|
for vol in vols:
|
||||||
txt = txt.replace(vol.realpath.encode("utf-8"), vol.vpath.encode("utf-8"))
|
bap = vol.realpath.encode("utf-8")
|
||||||
txt = txt.replace(
|
bhp = vol.histpath.encode("utf-8")
|
||||||
vol.realpath.encode("utf-8").replace(b"\\", b"\\\\"),
|
bvp = vol.vpath.encode("utf-8")
|
||||||
vol.vpath.encode("utf-8"),
|
bvph = b"$hist(/" + bvp + b")"
|
||||||
)
|
|
||||||
|
txt = txt.replace(bap, bvp)
|
||||||
|
txt = txt.replace(bhp, bvph)
|
||||||
|
txt = txt.replace(bap.replace(b"\\", b"\\\\"), bvp)
|
||||||
|
txt = txt.replace(bhp.replace(b"\\", b"\\\\"), bvph)
|
||||||
|
|
||||||
|
if txt != txt0:
|
||||||
|
txt += b"\r\nNOTE: filepaths sanitized; see serverlog for correct values"
|
||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue