Skip to content

Commit

Permalink
Merge branch 'bugfix/ARSN-448' into tmp/octopus/w/8.2/bugfix/ARSN-448
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Nov 29, 2024
2 parents f08e034 + 7402f09 commit 30ffc22
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/s3routes/routes/routeDELETE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function routeDELETE(
*/
if (err && (
!(err instanceof ArsenalError) ||
(!err.is.NoSuchKey && err.is.NoSuchVersion)
(!err.is.NoSuchKey && !err.is.NoSuchVersion)
)) {
return routesUtils.responseNoBody(err, corsHeaders,
response, undefined, log);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"engines": {
"node": ">=16"
},
"version": "8.1.141",
"version": "8.1.142",
"description": "Common utilities for the S3 project components",
"main": "build/index.js",
"repository": {
Expand Down
18 changes: 17 additions & 1 deletion tests/unit/s3routes/routeDELETE.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('routeDELETE', () => {
);
});

it('should return 204 when objectDelete encounters NoSuchKey or NoSuchVersion errors', () => {
it('should return 204 when objectDelete encounters NoSuchKey errors', () => {
request.objectKey = 'objectKey';
request.query = {};

Expand All @@ -107,6 +107,22 @@ describe('routeDELETE', () => {
);
});

it('should return 204 when objectDelete encounters NoSuchVersion errors', () => {
request.objectKey = 'objectKey';
request.query = {};

const noSuchVersionError = new ArsenalError('NoSuchVersion');
api.callApiMethod = jest.fn((method, req, res, log, callback) => {
callback(noSuchVersionError, {});
});

routeDELETE(request, response, api, log, statsClient);

expect(routesUtils.responseNoBody).toHaveBeenCalledWith(
null, {}, response, 204, log,
);
});

it('should return error code when objectDelete encounters non-arsenal errors', () => {
request.objectKey = 'objectKey';
request.query = {};
Expand Down

0 comments on commit 30ffc22

Please sign in to comment.