You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Event though the problem is taking place in ex-aws-s3, I think I've found the cause of my problems in the core ex-aws library
ExAws.Auth.Utils.uri_encode replaces the '+' that are in the filename with a space. This is having the impact of producing an invalid signature. I think this is being done for query params at the end of the path, but is having an impact on the path itself
ExAws.Request.Url.build doesn't url encode the path. I'm not sure if this should be done here at this level, or at the HttpClient level where the request is executed
The text was updated successfully, but these errors were encountered:
Environment
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
mix deps |grep ex_aws
ex_aws 2.1.1 (Hex package) (mix)
locked at 2.1.1 (ex_aws) 1e4de210
ex_aws_sqs 2.0.1 (Hex package) (mix)
locked at 2.0.1 (ex_aws_sqs) 42b19229
ex_aws_s3 2.0.2 (Hex package) (mix)
locked at 2.0.2 (ex_aws_s3) c0258bbd
mix deps | grep hackney
hackney 1.15.1 (Hex package) (rebar3)
locked at 1.15.1 (hackney) 9f8f471c
Current behavior
I'm trying to perform a head request on an object in a bucket I have access to:
ExAws.S3.head_object("test-bucket", "simples.wav") |> ExAws.request(aws_config)
which returns me the headers just fine.
If the request has a character that should be url encoded:
ExAws.S3.head_object("test-bucket", "b_+22222222_20190726T045247+0000_bf18e58a-0098-99fb-7dbb-be3539d8327a.wav") |> ExAws.request(aws_config)
I get a 404 error
If I url encode the object name
ExAws.S3.head_object("test-bucket", "b_%2B22222222_20190726T045247%2B0000_bf18e58a-0098-99fb-7dbb-be3539d8327a.wav") |> ExAws.request(aws_config)
I then get a 403 error
Expected behavior
I should get a 200 ok with the header details
{:ok, %{ headers: [ {"x-amz-id-2", "B9cWAN2B0szSy+Z4kw52gtzdqCxi70LmCN+g7nw/KNZtLWDv2CyU1MHdrdpzMpbiFk7pGv7RiU4="}, {"x-amz-request-id", "AF68FC0E0BBE2125"}, {"Date", "Fri, 26 Jul 2019 07:54:50 GMT"}, {"Last-Modified", "Fri, 26 Jul 2019 06:43:11 GMT"}, {"ETag", ""8d754d4e52dbb4e6613446f0d9832d91""}, {"x-amz-server-side-encryption", "AES256"}, {"Accept-Ranges", "bytes"}, {"Content-Type", "audio/x-wav"}, {"Content-Length", "1918444"}, {"Server", "AmazonS3"} ], status_code: 200 }}
What I've found
Event though the problem is taking place in ex-aws-s3, I think I've found the cause of my problems in the core ex-aws library
ExAws.Auth.Utils.uri_encode replaces the '+' that are in the filename with a space. This is having the impact of producing an invalid signature. I think this is being done for query params at the end of the path, but is having an impact on the path itself
ExAws.Request.Url.build doesn't url encode the path. I'm not sure if this should be done here at this level, or at the HttpClient level where the request is executed
The text was updated successfully, but these errors were encountered: