From 5be36e0ed78fefe0f4471a8aa05f631963d1d5c8 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Sat, 7 Dec 2024 00:02:15 +0100 Subject: [PATCH] fixup! Ensure we pass the right action name for delete object APIs --- lib/api/objectDelete.js | 7 ------- lib/routes/routeBackbeat.js | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/api/objectDelete.js b/lib/api/objectDelete.js index b8ec7fb168..d2045821bd 100644 --- a/lib/api/objectDelete.js +++ b/lib/api/objectDelete.js @@ -51,13 +51,6 @@ function objectDeleteInternal(authInfo, request, log, isExpiration, cb) { const reqVersionId = decodedVidResult; const hasGovernanceBypass = hasGovernanceBypassHeader(request.headers); - // Reassign a specific apiMethod, as monitoring can rely on the - // type of cloudserver instance to determine it comes from Backbeat routes. - // This is also needed for quota evaluation, where "routeBackbeat" cannot - // be used for different operations, such as putObject - // eslint-disable-next-line no-param-reassign - request.apiMethod = reqVersionId ? 'objectDeleteVersion' : 'deleteObject'; - const valParams = { authInfo, bucketName, diff --git a/lib/routes/routeBackbeat.js b/lib/routes/routeBackbeat.js index e081c46e9b..c28c14fed0 100644 --- a/lib/routes/routeBackbeat.js +++ b/lib/routes/routeBackbeat.js @@ -711,6 +711,16 @@ function putObject(request, response, log, callback) { } function deleteObjectFromExpiration(request, response, userInfo, log, callback) { + // Reassign a specific apiMethod, as it is needed for quota evaluation (at least), where + // "routeBackbeat" cannot be used as it is used for all backbeat API operations... + // eslint-disable-next-line no-param-reassign + request.apiMethod = 'deleteObject'; + + // Also need to fix `apiMethods`, which is kind of hard-coded to `objectReplicate` for backbeat + // routes. + // eslint-disable-next-line no-param-reassign + request.apiMethods = ['objectDelete', 'objectDeleteVersion', ...request.apiMethods]; + return objectDeleteInternal(userInfo, request, log, true, err => { if (err) { log.error('error deleting object from expiration', {