]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
authorSenthil Kumaran <senthil@uthcode.com>
Sat, 1 Jun 2013 15:24:31 +0000 (08:24 -0700)
committerSenthil Kumaran <senthil@uthcode.com>
Sat, 1 Jun 2013 15:24:31 +0000 (08:24 -0700)
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.

Lib/urllib.py

index f9655f9e88a47c021562ec660d9eeb3825b7ef06..32b4919f07fb2b10e26784341a221de39db1db58 100644 (file)
@@ -870,8 +870,7 @@ class ftpwrapper:
         self.ftp = ftplib.FTP()
         self.ftp.connect(self.host, self.port, self.timeout)
         self.ftp.login(self.user, self.passwd)
-        for dir in self.dirs:
-            self.ftp.cwd(dir)
+        self.ftp.cwd(os.path.join(*self.dirs))
 
     def retrfile(self, file, type):
         import ftplib