MrPrimate / tokenizer

Tiny yet capable in-game token editor for Foundry VTT
MIT License
29 stars 26 forks source link

[Bug] Loading an Image by URL fails with AWS S3 presigned URLs #181

Open korp0046 opened 6 days ago

korp0046 commented 6 days ago

The tokenizer module seems to be incorrectly modifying AWS S3 presigned URLs. The request made in the browser (via Network dev console) does not match what was input into the field. Same presigned URL works with the normal Foundry tokens and secenes. Note, the examples below have the exact domain changed for privacy reasons, but are otherwise exactly what was put in when the error was observed. This happens every time. The result of the issue is that the request fails and the image cannot be retrieved.

Request in Browser Dev Console: https://s3.mys3domain.com/mybucket/f0a0df09fbe7a176.jpg?1731185930981

Actual URL: https://s3.mys3domain.com/mybucket/f0a0df09fbe7a176.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=PGEZShe9NRieoZZ9HTGZ%2F20241109%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241109T205105Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=e3c68d939a6508d0c998cbc38bc24ee87c5f931de19ade9d01b70d27b81acb3e

MrPrimate commented 6 days ago

Please explain your problem a bit more.

When are you seeing this?

As far as I understand Foundry can't generate presigned URLs for S3. So when do you see this problem?

How can I replicate it?

korp0046 commented 2 days ago

If you put the URL i have above into the globe icon on the attached image with the developer console open, you'll see the URL that is used to try to retrieve the image does not match what is put in. It is modified/truncated. image