minio-js icon indicating copy to clipboard operation
minio-js copied to clipboard

bug: Presigned url content disposition

Open joaofranciscosantos opened this issue 2 years ago • 1 comments

There're at least 2 related bugs when calculating signature when you supply content disposition. If content disposition is, for example attachment; filename="qwew.png"; I'm able to generate presigned url and I can download file.

However, if I supply attachment; filename="qwew.png"; filename*=UTF-8''qwew.png;, It won't work. Problem seems to be with * character. I get XML 403 SignatureDoesNotMatch.

Also if I supply ! (or maybe any other special character) I get the same 403 with just attachment; filename="qwe!w.png";

Any of these combinations work fine when using aws sdk.

<Error>
  <Code>SignatureDoesNotMatch</Code>
  <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
  <Key>xxx</Key>
  <BucketName>xxx</BucketName>
  <Resource>xxx</Resource>
  <RequestId>xxx</RequestId>
  <HostId>xxx</HostId>
</Error>

minio sdk (403): https://...&response-content-disposition=attachment%3B%20filename%3D%22qwe!w.png%22%3B&....

aws sdk (200): https://...&response-content-disposition=attachment%3B%20filename%3D%22qwe%21w.png%22%3B&...

joaofranciscosantos avatar Jun 16 '22 10:06 joaofranciscosantos

I found that if I encode special charaters in filename it will work but I still have problem with filename*. I cannot do filename%2A in header because browser won't recognize it.

joaofranciscosantos avatar Jun 16 '22 11:06 joaofranciscosantos