]> git.ipfire.org Git - pbs.git/commitdiff
uploads: Manually commit the session
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Jan 2025 10:38:58 +0000 (10:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Jan 2025 10:38:58 +0000 (10:38 +0000)
This is required because the session might not be fast enough before the
client comes back with the payload. This ensures that we won't have a
race.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/uploads.py

index 23a33a55c95d789819bed2b5fd58daadeddcc286..122d03e59f47ce5573c7086e80f294b2f946748e 100644 (file)
@@ -96,6 +96,9 @@ class APIv1IndexHandler(base.APIMixin, base.BaseHandler):
                        except ValueError as e:
                                raise base.APIError(errno.EINVAL, "%s" % e) from e
 
+               # Commit the session before sending the response to the client
+               await self.db.commit()
+
                # Send the ID of the upload back to the client
                self.finish({
                        "id"         : "%s" % upload.uuid,