From: Senthil Kumaran Date: Sat, 1 Jun 2013 15:27:06 +0000 (-0700) Subject: Fix #17967: For ftp urls CWD to target instead of hopping to each directory X-Git-Tag: v3.4.0a1~586^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e42ae81f6a45f40a3f6a64192575bfc44f61bdb;p=thirdparty%2FPython%2Fcpython.git Fix #17967: For ftp urls CWD to target instead of hopping to each directory towards target. This fixes a bug where target is accessible, but parent directories are restricted. --- diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 786055ef0b69..1279322496f0 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -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