Subject: | bad tests for valid key, impossible to store or delete key "0" |
unless $key && length $key
This appears in 2 places in the code, and is wrong. $key could be "0".
If so, "unless $key" will fail. Here's a patch:
Index: lib/Net/Amazon/S3/Bucket.pm
===================================================================
--- lib/Net/Amazon/S3/Bucket.pm (revision 19410)
+++ lib/Net/Amazon/S3/Bucket.pm (working copy)
@@ -112,7 +112,7 @@
# returns bool
sub add_key {
my ( $self, $key, $value, $conf ) = @_;
- croak 'must specify key' unless $key && length $key;
+ croak 'must specify key' unless defined $key && length $key;
if ( $conf->{acl_short} ) {
$self->account->_validate_acl_short( $conf->{acl_short} );
@@ -260,7 +260,7 @@
# returns bool
sub delete_key {
my ( $self, $key ) = @_;
- croak 'must specify key' unless $key && length $key;
+ croak 'must specify key' unless defined $key && length $key;
return $self->account->_send_request_expect_nothing( 'DELETE',
$self->_uri($key), {} );
}