Skip to content

Commit

Permalink
fixup! Ensure we pass the right action name for delete object APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisferrand committed Dec 6, 2024
1 parent 1aa76e8 commit 5be36e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lib/api/objectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions lib/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit 5be36e0

Please sign in to comment.