flysystem-http icon indicating copy to clipboard operation
flysystem-http copied to clipboard

Already encoded URLs get unescaped and thus invalid

Open bkonetzny opened this issue 6 years ago • 0 comments

The protected method buildUrl does two things:

  1. Replace already encoded slashes (%2F) with /.
  2. Replace unencoded whitespace ( ) with %20.

While step two is correct to "fix" the URL, step one is not. There is a good case to have encoded slashes (%2F) in the URL. For example the image resizing server thumbor uses the following format for the URLs: https://thumbor-server/fit-in/100x100/path%2Fto%2Fimage.png (Format: SERVER/COMMANDS/ENCODED_IMAGE_SOURCE_PATH). Replacing the valid %2F will result in https://thumbor-server/fit-in/100x100/path/to/image.png and makes the URL invalid for thumbor. There might be other cases as well where this is explicitly not expected.

So I'd suggest to remove this replacement completely, or make it configurable.

bkonetzny avatar Feb 12 '19 18:02 bkonetzny