Compare commits

...

3 Commits

Author SHA1 Message Date
Rahul Padigela d379994a33 dont create a delete marker for non-existing objects 2020-04-10 00:06:46 -07:00
Rahul Padigela 85ce149543 check for non-existence 2020-04-09 23:58:53 -07:00
Rahul Padigela ba6fb6d75f bugfix: S3C-2758 don't create delete marker
This "fix" targeting a version suspended bucket, deletes the object and
it's data when a delete request is received without creating a delete
marker
2020-04-09 23:27:09 -07:00
2 changed files with 11 additions and 6 deletions

View File

@ -315,7 +315,17 @@ function preprocessingVersioningDelete(bucketName, bucketMD, objectMD,
// TODO check AWS behaviour for no deletion (seems having no error)
return callback(errors.NoSuchKey);
}
// not deleting any specific version, making a delete marker instead
// usually delete marker is created here
// this hacks the code to delete object and not create a delete marker
const vsBucket = bucketMD.getVersioningConfiguration()
&& bucketMD.getVersioningConfiguration().Status === 'Suspended';
if (!objectMD) {
return callback(errors.NoSuchKey);
}
if (vsBucket && objectMD) {
options.deleteData = true;
options.versionId = objectMD.versionId;
}
return callback(null, options);
}

View File

@ -141,11 +141,6 @@ function objectDelete(authInfo, request, log, cb) {
if (deleteInfo.newDeleteMarker) {
// if we created a new delete marker, return true for
// x-amz-delete-marker and the version ID of the new delete marker
if (result.versionId) {
resHeaders['x-amz-delete-marker'] = true;
resHeaders['x-amz-version-id'] = result.versionId === 'null' ?
result.versionId : versionIdUtils.encode(result.versionId);
}
pushMetric('putDeleteMarkerObject', log, { authInfo,
bucket: bucketName, keys: [objectKey] });
} else {