From: Michael Tremer Date: Wed, 26 Apr 2023 14:29:00 +0000 (+0000) Subject: uploads: Add an assertion for deleted uploads X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d7cc7d1b5a3f2a7eddca66d97b592faaa2936c0;p=pbs.git uploads: Add an assertion for deleted uploads Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/uploads.py b/src/buildservice/uploads.py index 1dc7c95a..481ca2af 100644 --- a/src/buildservice/uploads.py +++ b/src/buildservice/uploads.py @@ -273,6 +273,8 @@ class Upload(base.DataObject): return await asyncio.to_thread(self._copyinto, dst) def _copyinto(self, dst): + assert os.path.exists(self.path), "Upload has been deleted - %s" % self + # Open the source file and copy it into the destination file descriptor with open(self.path, "rb") as src: shutil.copyfileobj(src, dst)