Git Product home page Git Product logo

Comments (5)

sherwinski avatar sherwinski commented on June 17, 2024 1

After some testing on the latest library version, I can confirm that this is no longer an issue. Please feel free to comment back if, for whatever reason, this is still not the case.

from imgix-php.

jayeb avatar jayeb commented on June 17, 2024

@rubas I'm a little bit confused--you appear to be using rawurlencode() in both examples you've provided here. You're saying the top version doesn't work even though you're raw-encoding the $path variable on line 6?

Also, which version of the library are you using? As of version 1.2.1, if you pass true in as the third argument for the createURL() function, the given path will automatically be passed through rawurlencode(). You can see the implementation in PR #27. Does this solve your issue?

from imgix-php.

rubas avatar rubas commented on June 17, 2024

@jayeb sorry for the copy/paste typo in the example. I corrected them above.

It doesn't work if I don't manually encode the path before handing it over.

The PR #27 parameter is not helping as it seems it is only applied if the path starts with http?!

from imgix-php.

jayeb avatar jayeb commented on June 17, 2024

Ahh okay, I think I understand the issue now. The logic behind when and how to encode paths in our libraries isn't as straightforward as it seems it should be, and we're clearly not doing it correctly in all of our libraries. The correct logic is:

  • All paths are expected to be passed in unencoded
  • If the path matches /^https?:\/\//, it should be fully encoded, slashes and all (this is for web proxy sources, where the image path is actually a fully-qualified URL). From my research (my PHP-knowledge is a bit rusty), it seems like rawurlencode() is always preferred to urlencode().
  • If the path does not match /^https?:\/\//, it should be semi-encoded--encode illegal URL characters, leave everything else alone. There doesn't seem to be a native PHP function to handle this, so we'll need to do some jiggery-pokery to make this work.

I'm gonna put together a PR to iron this out once and for all--stay tuned.

from imgix-php.

rubas avatar rubas commented on June 17, 2024

rawurlencode should be used as it follows RFC 3986.

The problem is (as I understand it), that you are using the unencoded path to create the signature but the browser is handling those Umlaut automatically in background and calls Imgix with an encoded path. This means that the generated signature will not match.

Why are you not always encoding the path? Just make sure that / and maybe : is not encoded. (Either split with those delimeter or replace %2F and %3Aafterwards).

from imgix-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.