Skip to content

Unable to parse ExceptionName: XAmzContentSHA256Mismatch Message: #7391

Open
@hotwinters

Description

@hotwinters

Expected behavior

just putobject

Actual behavior

1

Steps to reproduce

bool AWSS3Manager::putObject(const Aws::String &bucketName, const Aws::String &fileName)
{
    Aws::S3::Model::PutObjectRequest request;
    request.SetBucket(bucketName);
    request.SetKey(fileName);

    // std::shared_ptr<Aws::IOStream> inputData =
    //     Aws::MakeShared<Aws::FStream>("SampleAllocationTag",
    //                                   fileName.c_str(),
    //                                   std::ios_base::in | std::ios_base::binary);

    // if (!*inputData)
    // {
    //     std::cerr << "Error unable to read file " << fileName << std::endl;
    //     return false;
    // }

    // request.SetBody(inputData);
    auto input_data = Aws::MakeShared<Aws::FStream>("PutObjectInputStream", fileName.c_str(), std::ios_base::in | std::ios_base::binary);
    request.SetBody(input_data);

    Aws::S3::Model::PutObjectOutcome outcome =
        client->PutObject(request);

    if (!outcome.IsSuccess())
    {
        std::cerr << "Error: putObject: " << outcome.GetError().GetMessage() << std::endl;
    }
    else
    {
        std::cout << "Added object '" << fileName << "' to bucket '"
                  << bucketName << "'.";
    }

    return outcome.IsSuccess();
}

Logs / stacktrace (if applicable)

Which SDK were you using?

C++

Which OS were you using?

Linux

SDK version

1.11.526

OS version

centos8

Metadata

Metadata

Assignees

Labels

BugAn update to fix incorrect code or typos.C++This issue relates to the AWS SDK for C++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions