Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getObjectAttributes() still downloads full file and Error parsing XML #598

Open
SeBsZ opened this issue Aug 18, 2022 · 0 comments
Open

getObjectAttributes() still downloads full file and Error parsing XML #598

SeBsZ opened this issue Aug 18, 2022 · 0 comments

Comments

@SeBsZ
Copy link

SeBsZ commented Aug 18, 2022

Hi there,

I'm trying to use $s3->getObjectAttributes() to grab a file's ETag but I see two issues with this. It seems (based on bandwidth) that this command still downloads the whole file which beats the purpose of just getting the attributes. Secondly, I'm getting an error.

The code and command I'm using:

$s3 = S3_Uploads\Plugin::get_instance()->s3();
        try {
            $data = $s3->getObjectAttributes(
                [
                    'Bucket' => S3_UPLOADS_BUCKET,
                    'Key'    => $key,
                    'ObjectAttributes' => array('ETag')
                ]
            );
            ...

This gives me an error:

"Error parsing response for GetObjectAttributes: AWS parsing error: Error parsing XML: String could not be parsed as XML"

My S3 provider is us-east-1.linodeobjects.com and I'm on version "humanmade/s3-uploads": "3.0.4".
I think it's also good to know that if I use $s3->getObject() the command works and I get the Guzzle stream as well as ETag, etc. (but my goal here is not to download the file).

If I change the 'ObjectAttributes' to 'ObjectAttributes' => array('ETag', 'ObjectSize') then it immediately fails with:

"Error executing "GetObjectAttributes" on "path?attributes"; AWS HTTP error: Client error: GET https://path?attributes resulted in a 403 Forbidden response:

SignatureDoesNotMatchtx00000000000001b570a59-0062fe (truncated...)

Hopefully someone can help me out, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant