Skip to content

Already encoded URLs get unescaped and thus invalid #3

Description

@bkonetzny

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions