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

Base.encode64 and url_encode64 do not accept :case as a valid option #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

agatheblues
Copy link

Hello!

This PR results from an error raised by Dialyzer, when using SecureRandom.base64() or SecureRandom.urlsafe_base64() in a function foo/0:

Function foo/0 has no local return.

While digging further, it turns out that Dialyzer raises because Base.encode64() and Base.url_encode64() do not support a :case option:

The function call will not succeed.

Base.encode64(binary(), [{:case, :lower}])

breaks the contract
(binary(), [{:padding, boolean()}]) :: binary()

See the recent elixir docs: https://hexdocs.pm/elixir/Base.html#url_encode64/2 & https://hexdocs.pm/elixir/Base.html#encode64/2.

I'm not sure if the option ever made sense (or why Dialyzer didn't raise this ealier in my project 🤷‍♀️) - but I hope the PR will at least help other peeps running into this issue, as the original Dialyzer error is cryptic 🥸.

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

Successfully merging this pull request may close these issues.

None yet

1 participant