[Zope-CVS] CVS: Packages/SFTPGateway/src/sftpgateway - connector.py:1.36

Fred L. Drake, Jr. fred at zope.com
Mon Dec 22 12:18:44 EST 2003


Update of /cvs-repository/Packages/SFTPGateway/src/sftpgateway
In directory cvs.zope.org:/tmp/cvs-serv9419

Modified Files:
	connector.py 
Log Message:
normalize paths before passing to the FTP server


=== Packages/SFTPGateway/src/sftpgateway/connector.py 1.35 => 1.36 ===
--- Packages/SFTPGateway/src/sftpgateway/connector.py:1.35	Mon Dec 22 12:02:34 2003
+++ Packages/SFTPGateway/src/sftpgateway/connector.py	Mon Dec 22 12:18:43 2003
@@ -130,7 +130,7 @@
             return function(ftpClient, *args, **kw)
 
     def _runPathCommand(self, ftpClient, cmd, path, handle_errors=True):
-        cmd = "%s %s" % (cmd, ftpClient.escapePath(path))
+        cmd = "%s %s" % (cmd, ftpClient.escapePath(posixpath.normpath(path)))
         d = ftpClient.queueStringCommand(cmd)
         if handle_errors:
             d.addErrback(self.checkErrors, path)
@@ -159,6 +159,7 @@
         filetransfer.FileTransferServer.connectionLost(self, reason)
 
     def openFile(self, path, flags, attrs):
+        path = posixpath.normpath(path)
         readable = flags & filetransfer.FXF_READ == filetransfer.FXF_READ
         writeable = flags & filetransfer.FXF_WRITE == filetransfer.FXF_WRITE
         if readable and writeable:
@@ -202,6 +203,7 @@
 
     def openDirectory(self, path):
         self._app.info("requested listing for %s", path)
+        path = posixpath.normpath(path)
         return self.withClient(self._openDirectory, path)
 
     def _openDirectory(self, ftpClient, path):
@@ -213,6 +215,7 @@
 
     def getAttrs(self, path, followLinks):
         self._app.info("requested attributes for %s", path)
+        path = posixpath.normpath(path)
         dir, base = posixpath.split(path)
         protocol = DirectoryListProtocol(self, dir)
         if path in ("", "/"):
@@ -257,6 +260,7 @@
 
     def readLink(self, path):
         self._app.info("reading link %r", path)
+        path = posixpath.normpath(path)
         return self.withClient(self._readFile, path)
 
     def _readLink(self, ftpClient, path):




More information about the Zope-CVS mailing list