From 450121eac993a188fdbb1ceea7a7b1b2c929b1ad Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 5 Nov 2022 13:24:00 +0000 Subject: [PATCH] ftpd: kde tries to cwd into images --- copyparty/ftpd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/copyparty/ftpd.py b/copyparty/ftpd.py index a8cc22c1..6a9d64fd 100644 --- a/copyparty/ftpd.py +++ b/copyparty/ftpd.py @@ -152,7 +152,14 @@ class FtpFs(AbstractedFS): return open(fsenc(ap), mode) def chdir(self, path: str) -> None: - self.cwd = join(self.cwd, path) + nwd = join(self.cwd, path) + vfs, rem = self.hub.asrv.vfs.get(nwd, self.uname, False, False) + ap = vfs.canonical(rem) + if not bos.path.isdir(ap): + # returning 550 is library-default and suitable + raise FilesystemError("Failed to change directory") + + self.cwd = nwd ( self.can_read, self.can_write,