Skip to content

Commit eb282f4

Browse files
CLDSRV-636: Migrate SSE on CopyObject and init MPU
1 parent 415781a commit eb282f4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/api/initiateMultipartUpload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const { getObjectSSEConfiguration } = require('./apiUtils/bucket/bucketEncryptio
2121
const { setExpirationHeaders } = require('./apiUtils/object/expirationHeaders');
2222
const { data } = require('../data/wrapper');
2323
const { setSSEHeaders } = require('./apiUtils/object/sseHeaders');
24+
const { updateEncryption } = require('./apiUtils/bucket/updateEncryption');
2425

2526
/*
2627
Sample xml response:
@@ -272,6 +273,8 @@ function initiateMultipartUpload(authInfo, request, log, callback) {
272273

273274
async.waterfall([
274275
next => metadataValidateBucketAndObj(metadataValParams, log,
276+
(error, destinationBucket, destObjMD) =>
277+
updateEncryption(error, destinationBucket, destObjMD, objectKey, log, { skipObject: true },
275278
(error, destinationBucket) => {
276279
const corsHeaders = collectCorsHeaders(request.headers.origin,
277280
request.method, destinationBucket);
@@ -284,7 +287,7 @@ function initiateMultipartUpload(authInfo, request, log, callback) {
284287
return next(error, corsHeaders);
285288
}
286289
return next(null, corsHeaders, destinationBucket);
287-
}),
290+
})),
288291
(corsHeaders, destinationBucket, next) => {
289292
if (destinationBucket.hasDeletedFlag() && accountCanonicalID !== destinationBucket.getOwner()) {
290293
log.trace('deleted flag on bucket and request from non-owner account');

lib/api/objectCopy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const monitoring = require('../utilities/metrics');
2424
const { getObjectSSEConfiguration } = require('./apiUtils/bucket/bucketEncryption');
2525
const { setExpirationHeaders } = require('./apiUtils/object/expirationHeaders');
2626
const { setSSEHeaders } = require('./apiUtils/object/sseHeaders');
27+
const { updateEncryption } = require('./apiUtils/bucket/updateEncryption');
2728

2829
const versionIdUtils = versioning.VersionID;
2930
const locationHeader = constants.objectLocationConstraintHeader;
@@ -251,6 +252,8 @@ function objectCopy(authInfo, request, sourceBucket,
251252
return async.waterfall([
252253
function checkDestAuth(next) {
253254
return metadataValidateBucketAndObj(valPutParams, log,
255+
(err, destBucketMD, destObjMD) =>
256+
updateEncryption(err, destBucketMD, destObjMD, destObjectKey, log, { skipObject: true },
254257
(err, destBucketMD, destObjMD) => {
255258
if (err) {
256259
log.debug('error validating put part of request',
@@ -265,7 +268,7 @@ function objectCopy(authInfo, request, sourceBucket,
265268
return next(errors.NoSuchBucket);
266269
}
267270
return next(null, destBucketMD, destObjMD);
268-
});
271+
}));
269272
},
270273
function checkSourceAuthorization(destBucketMD, destObjMD, next) {
271274
return metadataValidateBucketAndObj(valGetParams, log,

0 commit comments

Comments
 (0)