[Python-checkins] cpython (3.3): Fix #17967: For ftp urls CWD to target instead of hopping to each directory

senthil.kumaran python-checkins at python.org
Sat Jun 1 17:28:01 CEST 2013


http://hg.python.org/cpython/rev/dbfbdf2b5c19
changeset:   84007:dbfbdf2b5c19
branch:      3.3
parent:      83993:81c02d2c830d
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sat Jun 01 08:27:06 2013 -0700
summary:
  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.

files:
  Lib/urllib/request.py |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2273,8 +2273,7 @@
         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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list