aws-signer-v4-dot-net icon indicating copy to clipboard operation
aws-signer-v4-dot-net copied to clipboard

excaping issue

Open ddalacu opened this issue 4 years ago • 3 comments

While writing a some code for uploading files to s3 buckets i encountered a bug where when building the canonicalRequest your code would use "request.RequestUri.AbsolutePath" but that would already escape part of the request uri example: "/Assets/Translations/General/Chinese (Simplified).json" would become "/Assets/Translations/General/Chinese%20(Simplified).json" when accessing AbsolutePath property, i fixed this by calling Uri.UnescapeDataString(request.RequestUri.AbsolutePath) The final code looks like this for me:

var unescaped = Uri.UnescapeDataString(request.RequestUri.AbsolutePath); canonicalRequest.Append(string.Join("/", unescaped.Split('/').Select(Uri.EscapeDataString)) + "\n"); Maybe this it was my bad somewhere but maybe this can help you.

ddalacu avatar Jan 25 '21 16:01 ddalacu

Are you saying we shouldn't let it get escaped?

ronenfe avatar Mar 23 '22 17:03 ronenfe

Hello, yes i think you don't need to do that. But you should do some separate tests to confirm the bug.

ddalacu avatar Apr 18 '22 15:04 ddalacu

I've also run into this issue with spaces in the file path. Is there a fix?

nzbart avatar Jan 19 '23 23:01 nzbart