Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow buildUrl to use pre-encoded URLs #43

Open
heyitsbryanm opened this issue Jul 7, 2023 · 2 comments
Open

feat: allow buildUrl to use pre-encoded URLs #43

heyitsbryanm opened this issue Jul 7, 2023 · 2 comments

Comments

@heyitsbryanm
Copy link

heyitsbryanm commented Jul 7, 2023

Describe the feature

If the buildUrl function builds a Web Proxy URL with a pre-encoded URL, the URL will be double encoded. This returns a 400 error in the Rendering API.

To Reproduce

  1. Create a Web Proxy Source in imgix
  2. Use this Swift code (use your own secureUrlToken):
let signedClient = ImgixClient.init(
  host: "imgix-web-proxy-test-source.imgix.net",
  secureUrlToken: "EHFQXiZhxP4wA2c4"
)

// This will return a `400` error
signedClient.buildUrl("http%3A%2F%2Fassets.imgix.net%2Fexamples%2Fcat.jpg") // => https://imgix-library-secure-test-source.imgix.net/http%253A%252F%252Fassets.imgix.net%252Fexamples%252Fcat.jpg?s=5751ef13a5ca325fab9c4038b080cd80
@luqven
Copy link
Contributor

luqven commented Jul 7, 2023

Hey @heyitsbryanm, thanks for opening this issue!

This library expects you to give buildUrl() un-encoded paths.

In order to support encoded paths, we'd need to support a flag to remove all URL encoding (which means the URL might not get formatted in a way our render stack can parse) or support the end user passing us a custom encoding function, to replace our encoding behind the scenes.

I can't give you an exact time estimate, but I will now mark this as a feature request and add it to our backlog.

If someone else is interested in this feature, comment or react to this issue to help us prioritize.

@luqven luqven changed the title buildUrl returns a broken imgix URL when using pre-encoded URLs feat: allow buildUrl to use pre-encoded URLs Jul 7, 2023
@heyitsbryanm
Copy link
Author

Gotcha - changing the description to feature request 👍.

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

No branches or pull requests

2 participants