Subject: | Small bug in Amazon::S3::Bucket |
Date: | Thu, 22 Jun 2017 11:35:07 +0000 |
To: | "bug-Amazon-S3 [...] rt.cpan.org" <bug-Amazon-S3 [...] rt.cpan.org> |
From: | Ali Zia <aliz [...] broadbean.com> |
Hi there,
First off, thanks for building this module!
I noticed a slight bug which is related to getting an object from a bucket which can be found here https://metacpan.org/source/TIMA/Amazon-S3-0.45/lib/Amazon/S3/Bucket.pm#L92.
Basically that is building a hash reference using the content_type value which returns an array in this case, because assigning values in a hash are always in array contexts. This makes for a bad hash reference being returned from this sub routine when the content type from Amazon comes in as something like ‘text/plain ; charset=UTF-8’. This is because HTTP::Headers splits that string up and calls `wantarray` as the return type in it’s content_type method, so you end up with an incorrect hash like:
'content_length' => '5145',
'content_type' => 'text/plain',
'charset=UTF-8' => 'etag', <- uh oh
'e4ff8780e78c6421d35ed5c5870b8bac' => 'value',
The simplest way to fix this is to update L92 to read as content_type => $response->content_type || ‘’, which will make it into string context ☺
My perl version is 5.16.3, running on Ubuntu 14.04.
Hope you’re able to action on it soon!
Kind regards,
Ali Zia
Web Developer, Search
[ps://cb-design.s3.amazonaws.com/logos/broadbean/broadbean-withoutstrap-lime-rgb-signature.png]
Broadbean
South Quay Building, 189 Marsh Wall, London E14 9SH
D: +44 (0)80 0169 8003 O: +44 (0)80 0169 8003
broadbean.com<http://www.broadbean.com/> | LinkedIn<https://www.linkedin.com/company/broadbean-technology> | Facebook<https://www.facebook.com/Broadbean.Technology> | Twitter<https://twitter.com/BroadbeanEMEA> | Google+<https://plus.google.com/+broadbean> | Blog