Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PutObjectLegalHold using the s3 API fails #11920

@ghost

Description

Current Behavior

Request like this:

let toSubmit = {Bucket: bucketName, Key: key, LegalHold: {Status: "ON"}};
let legalHoldCommand = new PutObjectLegalHoldCommand(toSubmit);
let legalHoldResult = await this.s3.send(legalHoldCommand);

indicates that the MD5 was not calculated, so we go this route:

let toSubmit = {Bucket: bucketName, Key: key, LegalHold: {Status: "ON"}};
    toSubmit.ContentMD5 = crypto.createHash('md5').update('').digest('base64');
let legalHoldCommand = new PutObjectLegalHoldCommand(toSubmit);
let legalHoldResult = await this.s3.send(legalHoldCommand;

But then we see this error:

minio4_1  | API: PutObjectLegalHold(bucket=bucket3, object=foo99)
minio4_1  | Time: 18:42:04 UTC 03/29/2021
minio4_1  | DeploymentID: b60b8001-7b84-41ba-940e-c06713c09bf2
minio4_1  | RequestID: 1670E455FC9412DE
minio4_1  | RemoteHost: 192.168.XX.YY
minio4_1  | Host: minio4:9000
minio4_1  | UserAgent: aws-sdk-js/3.10.0
minio4_1  | Error: expected element type <LegalHold> but have <ObjectLockLegalHold> (xml.UnmarshalError)
minio4_1  |        4: cmd/api-errors.go:2009:cmd.toAPIErrorCode()
minio4_1  |        3: cmd/api-errors.go:2034:cmd.toAPIError()
minio4_1  |        2: cmd/object-handlers.go:2978:cmd.objectAPIHandlers.PutObjectLegalHoldHandler()
minio4_1  |        1: net/http/server.go:2069:http.HandlerFunc.ServeHTTP()`

Your Environment

  • Version: minio/minio:RELEASE.2021-03-26T00-00-41Z (although we've tried other previous releases; same issue)
  • Server setup and configuration: Docker on CentOS 7 (4 nodes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions