tylerhall / Autosmush

Losslessly compresses images in your Amazon S3 buckets on-the-fly.
http://clickontyler.com/blog/2010/10/automatically-compressing-your-amazon-s3-images-using-yahoos-smush-it-service/
121 stars 23 forks source link

URL Encoding Issue For Files with Spaces #17

Open jkkjonah opened 9 years ago

jkkjonah commented 9 years ago

As of today, the smush.it api endpoint expects all spaces in file name to be URL encoded pluses (%2B).

e.g.: Image Name = image with spaces.png

This returns null: http://www.smushit.com/ysmush.it/ws.php?img=http://s3.amazonaws.com/BUCKET/image%20with%20spaces.png

This returns the expected response: http://www.smushit.com/ysmush.it/ws.php?img=http://s3.amazonaws.com/BUCKET/image%2Bwith%2Bspaces.png

  1. The Autosmush library does not URL encode the image file path at all before calling CURL
  2. The special case of replacing spaces with plusses needs to be added before URL encoding