ente
ente copied to clipboard
Correct the order for creating s3 presigned objects
Note: I am still finding my way through the codebase. If this PR seems illogical LMK.
Description
In the current scenario, we first create a s3 object, presign it and then insert into the DB. If this fails just before inserting into the db, we have a dangling object we don't cleanup.
But if we first insert it in DB, then it should work fine as background cleaner will be able to find it always.
Maybe this is needed for multipart uploads as well, but it may not be trivial to fix that.