imgex icon indicating copy to clipboard operation
imgex copied to clipboard

Support unsigned URLs

Open jayjun opened this issue 6 years ago • 2 comments

I use unsigned URLs to purge images and as base URLs for clients to append their own parameters.

This pull request generates an unsigned URL when source.token is nil.

Imgex.url(path, params, %{token: nil})

However, I’m not entirely happy with this solution but it‘s the best I can come up with to maintain backwards compatibility. The most idiomatic way would be to pass an option to a trailing opts.

Imgex.url(path, params, sign: false)

Alternate source domains and tokens should be passed as opts too, but this is a breaking change.

What do you think?

jayjun avatar Dec 09 '19 15:12 jayjun

@ianwalter @axelson Follow up on this? :smile:

kianmeng avatar Dec 07 '21 22:12 kianmeng

@jayjun I don't really like the implicit behavior of token == nil means don't sign the url. Thinking about it a bit we could actually support a keyword list as the third argument since the third argument is currently a map. That way we could deprecate the old behavior without breaking any clients.

Also we need to ensure that srcset/3 works in a similar matter as well.

I don't plan on tackling this but I will review the code if someone else wants to tackle it.

axelson avatar Dec 08 '21 05:12 axelson