Skip to content

Commit

Permalink
[s3] fix crash when cleaning up after aborted connection (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneier committed Sep 17, 2023
1 parent 7d7bfdb commit c766248
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions storages/backends/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ def _create_empty_on_close(self):

def close(self):
if self._is_dirty:
self._flush_write_buffer()
self._multipart.complete(MultipartUpload={"Parts": self._parts})
if self._multipart is not None:
self._flush_write_buffer()
self._multipart.complete(MultipartUpload={"Parts": self._parts})
else:
if self._multipart is not None:
self._multipart.abort()
Expand Down

0 comments on commit c766248

Please sign in to comment.