Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
with open(self.path, "wb") as dst:
shutil.copyfileobj(src, dst)
+ # Check that we didn't copy too much
+ if dst.tell() > self.size:
+ raise OverflowError
+
async def copyinto(self, dst):
"""
Copies the content of this upload into the destination file descriptor.
"""
Creates an upload of a certain size, but then tries to write more data
"""
- payload = io.BytesIO(b"01234567890123456789")
+ payload = io.BytesIO(b"012345678901234567890123456789")
with self.db.transaction():
upload = self.backend.uploads.create("test.blob", size=20, user=self.user)