From: Michael Tremer Date: Tue, 1 Jul 2025 17:39:53 +0000 (+0000) Subject: uploads: Don't delete successful uploads X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cb291aa270c08f495a38dc585417b2347c6dcee;p=pbs.git uploads: Don't delete successful uploads The delete_on_close flag is doing something different from what I throught and therefore we will have to handle this ourselves. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/uploads.py b/src/buildservice/uploads.py index 7bca4d9a..44b709fc 100644 --- a/src/buildservice/uploads.py +++ b/src/buildservice/uploads.py @@ -316,13 +316,17 @@ class UploadStream(object): if type is None: return await self.close() + # If there was an exception, we delete the file + if self.f: + await self.backend.unlink(self.f.name) + async def write(self, chunk): """ Writes a chunk to the file and puts it into the hasher, too. """ # Open a temporary file unless already done so (we cannot do this in the constructor) if self.f is None: - self.f = await self.backend.tempfile(prefix="upload-", delete_on_close=False) + self.f = await self.backend.tempfile(prefix="upload-", delete=False) # Write the chunk await self.f.write(chunk)