[go: up one dir, main page]

Skip to content

Commit

Permalink
Use Elixir's URI.new/1 to parse URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyates committed Jan 30, 2024
1 parent ae6e5d9 commit 877ae97
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ VERSION 0.6

all:
BUILD \
--build-arg ELIXIR_BASE=1.9.4-erlang-20.3.8.26-alpine-3.11.6 \
--build-arg ELIXIR_BASE=1.11.3-erlang-23.2.7.5-alpine-3.16.0 \
--build-arg ELIXIR_BASE=1.13.0-erlang-22.3.4.2-alpine-3.12.0 \
--build-arg ELIXIR_BASE=1.14.5-erlang-24.3.4.15-alpine-3.18.4 \
+test

test:
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ by adding `ecto_commons` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ecto_commons, "~> 0.3.3"}
{:ecto_commons, "~> 0.3.4"}
]
end
```

## Incompatibility Warning

In order to check whether URLs are parseable,
this library requires either a recent (>= 1.13.0) of Elixir,
or an older (< 26) version of OTP.

If you need to use Elixir < 1.12 **together with** OTP >= 26, please use version "0.3.3".

## Documentation

Documentation is published on [HexDocs](https://hexdocs.pm) and can
be found at [https://hexdocs.pm/ecto_commons](https://hexdocs.pm/ecto_commons).

Expand Down
2 changes: 1 addition & 1 deletion lib/validators/url.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defmodule EctoCommons.URLValidator do
end

defp do_validate_url(value, _parsed, :parsable) do
case :http_uri.parse(String.to_charlist(value)) do
case URI.new(value) do
{:ok, _uri} -> :ok
{:error, _msg} -> :error
end
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule EctoCommons.MixProject do
use Mix.Project

@version "0.3.3"
@version "0.3.4"

def project do
[
Expand All @@ -12,7 +12,7 @@ defmodule EctoCommons.MixProject do
source_url: "https://github.com/achedeuzot/ecto_commons",
homepage_url: "http://hexdocs.pm/ecto_commons",
package: package(),
elixir: "~> 1.9",
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
docs: docs(),
Expand Down

0 comments on commit 877ae97

Please sign in to comment.