-
Notifications
You must be signed in to change notification settings - Fork 94
#221 uri encoding fixes #276
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
base: master
Are you sure you want to change the base?
Changes from all commits
f5ae7c5
b74df33
461f289
76a3c9a
89ab3c2
b5e184e
ff61959
31e9522
8db823b
ac1db95
26a4684
0c0ce2a
2eade6d
ec86cc8
4951696
b47d8b2
dd26694
4028918
18c4d84
eeb82e8
b32ddf3
f484e4c
4d9c3c0
0b25331
15eed02
69cf465
d83d880
3609b95
e263be7
c73dcf1
0897bfe
fc83643
f30952d
93eb446
6fa947e
f2a681e
0048de0
07b8b79
af9fb3c
9da7bfd
d120dc2
83a8033
6752127
8480411
6a77fe7
a525999
6680634
902805b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ package Paws::API::Builder::Paws { | |
use Moose; | ||
|
||
sub version { | ||
'0.38'; | ||
'0.39'; | ||
} | ||
|
||
sub services { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package Paws::Net::NoResponseMockCaller; | ||
use Moose; | ||
|
||
with 'Paws::Net::RetryCallerRole', 'Paws::Net::CallerRole'; | ||
|
||
use Paws::Net::APIResponse; | ||
use File::Slurper qw(read_text write_text); | ||
use JSON::MaybeXS; | ||
use Moose::Util::TypeConstraints; | ||
use Path::Tiny; | ||
|
||
has file => (is => 'rw', isa => 'Str', trigger => \&_set_file); | ||
|
||
has real_caller => ( | ||
is => 'ro', | ||
does => 'Paws::Net::CallerRole', | ||
default => sub { | ||
require Paws::Net::Caller; | ||
Paws::Net::Caller->new; | ||
} | ||
); | ||
|
||
has actual_request => ( | ||
is => 'rw', | ||
isa => 'Object', | ||
lazy => 1, | ||
default => sub { '' }, | ||
); | ||
|
||
has _encoder => (is => 'ro', default => sub { JSON::MaybeXS->new(canonical => 1) }); | ||
|
||
sub send_request { | ||
my ($self, $service, $call_object) = @_; | ||
|
||
$self->actual_request($service->prepare_request_for_call($call_object)); | ||
my $actual_call = $self->_encoder->encode($service->to_hash($call_object)); | ||
|
||
# we don't care about the response | ||
return {}; | ||
}; | ||
|
||
sub caller_to_response { | ||
my ($self, $service, $call_object, $response) = @_; | ||
|
||
return $response; | ||
}; | ||
|
||
1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ package Paws::Net::RestXmlCaller; | |
|
||
my %p; | ||
foreach my $att (grep { $_ !~ m/^_/ } $params->meta->get_attribute_list) { | ||
|
||
# e.g. S3 metadata objects, which are passed in the header | ||
next if $params->meta->get_attribute($att)->does('Paws::API::Attribute::Trait::ParamInHeaders'); | ||
|
||
|
@@ -79,6 +79,14 @@ package Paws::Net::RestXmlCaller; | |
{ | ||
if ($attribute->does('Paws::API::Attribute::Trait::ParamInURI')) { | ||
my $att_name = $attribute->name; | ||
my $non_print = join('', map { chr($_) } (128..255) ); | ||
if ($call->$att_name =~ /[{^}`\[\]><#%'"~|\\$non_print]/) { | ||
return Paws::Exception->throw( | ||
message => "Found unacceptable content in $att_name parameter", | ||
code => 'InvalidInput', | ||
request_id => '', | ||
); | ||
} | ||
if ($uri_attrib_is_greedy{$att_name}) { | ||
$vars->{ $attribute->uri_name } = uri_escape_utf8($call->$att_name, q[^A-Za-z0-9\-\._~/]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the I can probably find some time to work on this to send a fix and tests. i.e. Key = There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, sorry, I didn't see these comments - this change hasnt been merged yet, however we're working on it. The issue should be fixed in #265 , there's a test in t/s3/uri_encoding.t that checks = is encoded . Are you saying it shouldn't be? Its on the list here: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html See "Characters that might require special handling" section. (Though the "might" makes for great documentation.. either we do or we don't.. !) |
||
$uri_template =~ s{$att_name\+}{\+$att_name}g; | ||
|
@@ -120,7 +128,7 @@ package Paws::Net::RestXmlCaller; | |
elsif ($attribute->does('Paws::API::Attribute::Trait::ParamInHeaders')) { | ||
my $map = $attribute->get_value($call)->Map; | ||
my $prefix = $attribute->header_prefix; | ||
for my $header (keys %{$map}) { | ||
for my $header (keys %{$map}) { | ||
my $header_name = $prefix . $header; | ||
$request->headers->header( $header_name => $map->{$header} ); | ||
} | ||
|
@@ -179,11 +187,11 @@ package Paws::Net::RestXmlCaller; | |
|
||
my $xml = ''; | ||
foreach my $attribute ($call->meta->get_all_attributes) { | ||
if ($attribute->has_value($call) and | ||
if ($attribute->has_value($call) and | ||
not $attribute->does('Paws::API::Attribute::Trait::ParamInHeader') and | ||
not $attribute->does('Paws::API::Attribute::Trait::ParamInQuery') and | ||
not $attribute->does('Paws::API::Attribute::Trait::ParamInURI') and | ||
not $attribute->does('Paws::API::Attribute::Trait::ParamInBody') and | ||
not $attribute->does('Paws::API::Attribute::Trait::ParamInBody') and | ||
not $attribute->type_constraint eq 'Paws::S3::Metadata' | ||
) { | ||
my $attribute_value = $attribute->get_value($call); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a Data::Dumper print in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has been fixed long ago as 42 does not show the behaviour.
If you are in doupt try this branch all the S3 commands are working there
https://github.com/byterock/aws-sdk-perl/tree/s3ObjectTagging
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I was mistaken by this pull request still being open if it is supposedly fixed in 0.42 release? I don't know.
I cloned both the
pplu/aws-sdk-perl
branch ofrelease/0.42
and your fork'ss3ObjectTagging
branch and I still run into URI encoding issues, namely related to the=
symbol in S3 object keys. I guess I should open a separate ticket/pull request for that.i.e. Key =
client=TEST/year=2020/month=01/day=02/test.txt'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be good
you would help me alot if you ran it against the s3ObjectTagging branch as well.
Though I do not think I have touched the 'Paws::Net::Caller' class in my branch.
Any of the S3 commands that run though the RestXml callers and responders have been fixed up.
Hopefully there will be a relase that will get things a little more stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so a doc or bucket key like this
TEST/year=2020/month=01/day=02/test.txt
well have a look and see what happens
not a very good name for a bucket ;) but that is not my call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the recommended way to prefix object keys in order to get out of the box Hive-partitioning in S3.
https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-partitions.html