[Python-checkins] cpython (2.7): 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:00 CEST 2013


http://hg.python.org/cpython/rev/0a544bb539e6
changeset:   84006:0a544bb539e6
branch:      2.7
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sat Jun 01 08:24:31 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.py |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


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