-
Notifications
You must be signed in to change notification settings - Fork 7
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
EctoFields.URL does not support URLs with ports in them #10
Comments
Actually, looking at the code it seems like there are probably a great deal of valid URLs that wouldn't be correctly treated. However what Suitable fixes that I can think of:
|
I used something like this: @spec valid_url?(any()) :: boolean()
def valid_url?(url) when is_binary(url) do
case URI.parse(url) do
%URI{host: nil} -> false
%URI{scheme: nil} -> false
%URI{} -> true
end
end
def valid_url?(_), do: false |
I've added support for ports and IP addresses via these commits 7d39c88...master @joeapearson Yes, the idea is to have sensible handling for most use cases. In your estimation is the current implementation too restrictive or too permissive? |
I feel it is too restrictive. If Apparently it does not allow simply authentication details in url right now.
|
For example:
Problem appears to be at https://github.com/jerel/ecto_fields/blob/master/lib/fields/url.ex#L60
The text was updated successfully, but these errors were encountered: