diff --git a/pyftpdlib/handlers.py b/pyftpdlib/handlers.py index a888eb9f..c83b38d9 100644 --- a/pyftpdlib/handlers.py +++ b/pyftpdlib/handlers.py @@ -659,7 +659,13 @@ def push_with_producer(self, producer): self.initiate_send = self.initiate_sendfile return debug("starting transfer using send()", self) - AsyncChat.push_with_producer(self, producer) + if self.file_obj: + if os.path.getsize(self.file_obj.name) > 0: + # send if file size > 0 + debug("%s" % os.path.getsize(self.file_obj.name)) + AsyncChat.push_with_producer(self, producer) + else: + AsyncChat.push_with_producer(self, producer) def close_when_done(self): asynchat.async_chat.close_when_done(self)