Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TftpFileNotFoundError' is not processed correctly in TftpContexts.py->TftpContextClientDownload->start() #134

Open
LeoWeiLeoWei opened this issue Jul 6, 2022 · 0 comments
Labels
pending Not looking at it yet

Comments

@LeoWeiLeoWei
Copy link

LeoWeiLeoWei commented Jul 6, 2022

except TftpFileNotFoundError as err:
       # If we received file not found, then we should not save the open
       # output file or we'll be left with a size zero file. Delete it,
       # if it exists.
       log.error("Received File not found error")
       if self.fileobj is not None and not self.filelike_fileobj:
           if os.path.exists(self.fileobj.name):
                log.debug("unlinking output file of %s", self.fileobj.name)
                os.unlink(self.fileobj.name)

       raise

When downloading a file that not exists on TFTP-Server. The local file object has been opened in init(), but not closed yet here. So, when calling os.unlink(), it will raise another exception 'PermissionError'.
Please confirm and fix it. Thanks very much.

@msoulier msoulier added the pending Not looking at it yet label Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Not looking at it yet
Projects
None yet
Development

No branches or pull requests

2 participants