]> granicus.if.org Git - python/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:27:06 +0000 (08:27 -0700)
committerSenthil Kumaran <senthil@uthcode.com>
Sat, 1 Jun 2013 15:27:06 +0000 (08:27 -0700)
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.

Lib/urllib/request.py

index 786055ef0b69cafa929e1ad1a501a5ffd9c4c7f6..1279322496f0ee129710dbf97d3b9f78cc054c77 100644 (file)
@@ -2273,8 +2273,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