rlauer6 / perl-amazon-s3

A portable client library for working with and managing Amazon S3 buckets and keys.
http://search.cpan.org/dist/Amazon-S3/
2 stars 7 forks source link

get_location_constraint has an issue #13

Closed comewalk closed 1 year ago

comewalk commented 1 year ago

Hi, I would like to let you know get_location_constraint has an issue.

Reproduce

#!/usr/bin/perl
use strict;
use warnings;
use Amazon::S3;

my $s3 = Amazon::S3->new({
    aws_access_key_id     => 'YOUR ACCESS KEY',
    aws_secret_access_key => 'YOUR SECRET',
    region                => 'us-east-1',
});

my $bucket = $s3->bucket({ bucket => 'YOUR BUCKET' });

print "------------------------\n";
my $loc = $bucket->get_location_constraint();
print "$loc\n";
print "------------------------\n";

Fill in YOUR ACCESS KEY, YOUR SECRET and YOUR BUCKET for yours, and run above script, then the following error occurred.

Actual

$ perl -I local/lib/perl5 getlocation_error.pl
------------------------
Can't use string ("us-east-1") as a HASH ref while "strict refs" in use at local/lib/perl5/Amazon/S3/Bucket.pm line 1080.

Expected

perl -I local/lib/perl5/ getlocation_error.pl 
------------------------
us-east-1
------------------------

Suggestion

https://github.com/rlauer6/perl-amazon-s3/blob/8bd099e8b408bd7231d426395dd65a3604e28bc0/src/main/perl/lib/Amazon/S3/Bucket.pm.in#L1080

$_xpc is already parsed in _send_request by _xpc_of_content. The line should be below.

- $lc = $xpc->{content}; 
+ $lc = $xpc; 

Thanks in advance!

rlauer6 commented 1 year ago

Thanks for the report. Fixed in 0.64

comewalk commented 1 year ago

@rlauer6 I updated to 0.64. Then I confirmed the issue was fixed. Thank you!