]> git.ipfire.org Git - pbs.git/commitdiff
uploads: Add an assertion for deleted uploads
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Apr 2023 14:29:00 +0000 (14:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Apr 2023 14:29:00 +0000 (14:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/uploads.py

index 1dc7c95a34b97975440d4acdc2e0e330b1eead10..481ca2af22441206827d4cc5cd517c7adace2100 100644 (file)
@@ -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)