* Keep metadatas when the object is restored from cold storage * but remove the specific ones we don't want to keep * @param {object} objMD - obj metadata * @param {object} metadataStoreParams - custom built object containing resource details. * @return {undefined}
(objMD, metadataStoreParams)
| 479 | * @return {undefined} |
| 480 | */ |
| 481 | function restoreMetadata(objMD, metadataStoreParams) { |
| 482 | /* eslint-disable no-param-reassign */ |
| 483 | const userMDToSkip = ['x-amz-meta-scal-s3-restore-attempt']; |
| 484 | // We need to keep user metadata and tags |
| 485 | Object.keys(objMD).forEach(key => { |
| 486 | if (key.startsWith('x-amz-meta-') && !userMDToSkip.includes(key)) { |
| 487 | metadataStoreParams.metaHeaders[key] = objMD[key]; |
| 488 | } |
| 489 | }); |
| 490 | |
| 491 | if (objMD['x-amz-website-redirect-location']) { |
| 492 | if (!metadataStoreParams.headers) { |
| 493 | metadataStoreParams.headers = {}; |
| 494 | } |
| 495 | metadataStoreParams.headers['x-amz-website-redirect-location'] = objMD['x-amz-website-redirect-location']; |
| 496 | } |
| 497 | |
| 498 | if (objMD.replicationInfo) { |
| 499 | metadataStoreParams.replicationInfo = objMD.replicationInfo; |
| 500 | } |
| 501 | |
| 502 | if (objMD.legalHold) { |
| 503 | metadataStoreParams.legalHold = objMD.legalHold; |
| 504 | } |
| 505 | |
| 506 | if (objMD.acl) { |
| 507 | metadataStoreParams.acl = objMD.acl; |
| 508 | } |
| 509 | |
| 510 | metadataStoreParams.creationTime = objMD['creation-time']; |
| 511 | metadataStoreParams.lastModifiedDate = objMD['last-modified']; |
| 512 | metadataStoreParams.taggingCopy = objMD.tags; |
| 513 | } |
| 514 | |
| 515 | /** overwritingVersioning - return versioning information for S3 to handle |
| 516 | * storing version metadata with a specific version id. |
no outgoing calls
no test coverage detected