diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index edc082f9290..003373b5b37 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -818,7 +818,6 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { $this->getCache()->update($stat['fileid'], $stat); } } catch (S3MultipartUploadException|S3Exception $e) { - $this->objectStore->abortMultipartUpload($urn, $writeToken); $this->logger->error( 'Could not complete multipart upload ' . $urn . ' with uploadId ' . $writeToken, [ @@ -826,6 +825,17 @@ class ObjectStoreStorage extends Common implements IChunkedFileWrite { 'exception' => $e, ] ); + try { + $this->objectStore->abortMultipartUpload($urn, $writeToken); + } catch (S3Exception $e) { + $this->logger->error( + 'Failed to abort multi-part upload for ' . $urn . ' with uploadId ' . $writeToken, + [ + 'app' => 'objectstore', + 'exception' => $e, + ] + ); + } throw new GenericFileException('Could not write chunked file'); } return $size;