weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.84k stars 187 forks source link

Imageresizer working incorrect, when we use additional arg in query_string #358

Closed rockbesst closed 1 year ago

rockbesst commented 1 year ago

We using weserv resizer as docker container to resize images for website. And we send requests to resizer with query_string like this: ?v=1666706784000&w=200&h=176&fit=cover&il v= is our specific parameter for another reason. When v= is the first parameter, all working correctly, but when I move parameter v= to another position, for example "?w=200&h=300&v=1666706784000&fit=cover&il", resizer will crop image to 4:3 with height 176. I think, this crop is some default operation, but I don't understand why parameter v= breaking resizer's logic. Is this a bug, or I did something wrong?

giautm commented 1 year ago

if ?v= is a part of url param, I think you should encode the URL with encodeURLComponent function before passing it to the resize service.

kleisauke commented 1 year ago

This has been fixed with commit https://github.com/weserv/images/commit/0955dc1cec0b28e6c3d74c63f5c7da97507f0208, which has just been rolled out to production. Thanks for reporting this!