giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.65k stars 265 forks source link

After the open file is completed(fs.open), it seems that there is no call to close it(fd) when it is passed to FileProducer. #618

Closed sunday-will closed 7 months ago

sunday-will commented 7 months ago

After the open file is completed(fs.open), it seems that there is no call to close it(fd).

    def ftp_RETR(self, file):
        """Retrieve the specified file (transfer from the server to the
        client).  On success return the file path else None.
        """
        rest_pos = self._restart_position
        self._restart_position = 0
        try:
            fd = self.run_as_current_user(self.fs.open, file, 'rb')
        except (EnvironmentError, FilesystemError) as err:
            why = _strerror(err)
            self.respond('550 %s.' % why)
            return
        ...