]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patches by Michael Reilly to correctly deal with ftp URLs of the form
authorGuido van Rossum <guido@python.org>
Wed, 18 Aug 1999 21:51:10 +0000 (21:51 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 18 Aug 1999 21:51:10 +0000 (21:51 +0000)
ftp://user@host//root/path: the double slash in the pathname means to
go to the root directory even if the initial directory isn't the root.

Lib/ftplib.py

index d2ff435700423950ea9f394940302eb9d5d98093..eee8e5a82650b47614edcefdfed25a5d1f24d367 100644 (file)
@@ -437,6 +437,8 @@ class FTP:
                        except error_perm, msg:
                                if msg[:3] != '500':
                                        raise error_perm, msg
+               elif dirname == '':
+                       dirname = '.'  # does nothing, but could return error
                cmd = 'CWD ' + dirname
                return self.voidcmd(cmd)