Skip to content

Commit

Permalink
Fix inflight handling for multiObjectDelete
Browse files Browse the repository at this point in the history
Issue: CLDSRV-590
  • Loading branch information
francoisferrand committed Dec 8, 2024
1 parent 7149ef5 commit 5b40bb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/api/multiObjectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const { overheadField } = require('../../constants');
const versionIdUtils = versioning.VersionID;
const { data } = require('../data/wrapper');
const logger = require('../utilities/logger');
const { validateQuotas } = require('./apiUtils/quotas/quotaUtils');
const { processBytesToWrite, validateQuotas } = require('./apiUtils/quotas/quotaUtils');

/*
Format of xml request:
Expand Down Expand Up @@ -333,9 +333,11 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,

return callback(null, objMD, versionId);
},
(objMD, versionId, callback) => validateQuotas(
request, bucket, request.accountQuotas, ['objectDelete'], 'objectDelete',
-objMD?.['content-length'] || 0, false, log, err => callback(err, objMD, versionId)),
(objMD, versionId, callback) => {
const bytes = processBytesToWrite('objectDelete', bucket, versionId, 0, objMD);
return validateQuotas(request, bucket, request.accountQuotas, ['objectDelete'],
'objectDelete', bytes, false, log, err => callback(err, objMD, versionId));
},
(objMD, versionId, callback) => {
const options = preprocessingVersioningDelete(
bucketName, bucket, objMD, versionId, config.nullVersionCompatMode);
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/api/multiObjectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ describe('getObjMetadataAndDelete function for multiObjectDelete', () => {
headers: {},
parsedContentLength: contentLength,
}, postBody);
const bucket = { getVersioningConfiguration: () => null, getQuota: () => 0 };
const bucket = {
isVersioningEnabled: () => false,
getVersioningConfiguration: () => null,
getQuota: () => 0,
};

beforeEach(done => {
cleanup();
Expand Down

0 comments on commit 5b40bb3

Please sign in to comment.