Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Does not handle keys with multiple consecutive "/" characters #96

@kpeters-cbsi

Description

@kpeters-cbsi

Using version 0.87.

I'm trying to retrieve a key similar to "foo//bar/baz/bak/20210208160007". Using the AWS S3 CLI, the following works:

aws s3api head-object --bucket my-bucket --key "foo//bar/baz/bak/20210208160007"

But using Net::Amazon::S3, the following code snippet dies:

use strict;
use warnings;

use Net::Amazon::S3;
use Data::Dumper;

my $bucket = 'my-bucket';
my $key = 'foo//bar/baz/bak/20210208160007';

my $s3 = Net::Amazon::S3->new( {use_iam_role => 1, retry => 1} );
my $b = $s3->bucket($bucket);
my $res = $b->get_key($key) or do {
    my $err = '';
    if ($s3->err) {
        $err .= $s3->err . ': ';
    }
    if ($s3->errstr) {
        $err .= $s3->errstr;
    }
    die $err if $err;
    die "s3 did not indicate the cause of the error";
};

Looking at this a bit, I noted that Net::Amazon::S3::Request::_build_signed_request will replace multiple consecutive / chars with a single /. While I think this is related, simply commenting out that line didn't cut it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions