]> git.ipfire.org Git - pbs.git/commitdiff
uploads: Fail quickly if no payload was received
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Oct 2023 09:18:55 +0000 (09:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Oct 2023 09:18:55 +0000 (09:18 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/uploads.py

index 9414b06c1e8ebe6164576dc1576f690a80a84a9b..e6c6d76946f82697cee8d68f0d120de9e98ab8cf 100644 (file)
@@ -130,6 +130,10 @@ class APIv1DetailHandler(base.APIMixin, tornado.web.RequestHandler):
                if not upload:
                        raise tornado.web.HTTPError(404, "Could not find upload %s" % uuid)
 
+               # Fail if we did not receive anything
+               if not self.buffer.tell():
+                       raise tornado.web.HTTPError(400, "No data received")
+
                # Import the payload from the buffer
                with self.db.transaction():
                        try: