Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions lib/api/apiUtils/object/createAndStoreObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,19 @@ function createAndStoreObject(
}
}

const headerChecksum = areChecksumsEnabled() ? getChecksumDataFromHeaders(request.headers) : null;
if (headerChecksum && headerChecksum.error) {
return next(arsenalErrorFromChecksumError(headerChecksum));
// A delete marker has no body and no checksum: an

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is very long, I would try to extract logic to a new function. It's nits but this function are a nightmare to debug and follow.

// x-amz-checksum-* header describes the request payload
// (e.g. a multi-object delete XML).
let checksums = { primary: null, secondary: null };
if (!isDeleteMarker) {
const headerChecksum = areChecksumsEnabled()
? getChecksumDataFromHeaders(request.headers)
: null;
if (headerChecksum && headerChecksum.error) {
return next(arsenalErrorFromChecksumError(headerChecksum));
}
checksums = { primary: headerChecksum || defaultChecksumData, secondary: null };
}
const checksums = {
primary: headerChecksum || defaultChecksumData,
secondary: null,
};
return dataStore(
objectKeyContext,
cipherBundle,
Expand Down
2 changes: 1 addition & 1 deletion lib/api/multiObjectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function getObjMetadataAndDelete(
overheadField,
log,
's3:ObjectRemoved:DeleteMarkerCreated',
(err, result) => callback(err, objMD, deleteInfo, result.versionId),
(err, result) => callback(err, objMD, deleteInfo, result?.versionId),
);
},
],
Expand Down
Loading
Loading