Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e42ae8

Browse files
committed
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.
1 parent 7d15b54 commit 4e42ae8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Lib/urllib/request.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,8 +2273,7 @@ def init(self):
22732273
self.ftp = ftplib.FTP()
22742274
self.ftp.connect(self.host, self.port, self.timeout)
22752275
self.ftp.login(self.user, self.passwd)
2276-
for dir in self.dirs:
2277-
self.ftp.cwd(dir)
2276+
self.ftp.cwd(os.path.join(*self.dirs))
22782277

22792278
def retrfile(self, file, type):
22802279
import ftplib

0 commit comments

Comments
 (0)