Skip to content

s3 copyObject does not work to update metadata #274

@doapp-ryanp

Description

@doapp-ryanp

copyObject() is the only way I know of to update and exsting s3 object's metadata. When updating an object to add the Cache-Control header I get the following error. I also tried adding 'Metadata'=>array('updated'=>'1') but get same error:

This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes

Its simple to re-produce:

    $s3->copyObject(array(
        'Bucket' => 'mybucket',
        'CopySource'=> 'mybucket/test.gz',
        'Key' => 'test.gz',
        'ACL' => CannedAcl::PUBLIC_READ,
        'CacheControl' => "max-age=60, public",
        'Metadata'=>array('updated'=>'1')
    ));

For what its worth, this bug also exists in the aws cli tool. see aws/aws-cli#652

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions