diff --git a/lib/authoritex/getty/base.ex b/lib/authoritex/getty/base.ex index 18ffddd..ec98aa5 100644 --- a/lib/authoritex/getty/base.ex +++ b/lib/authoritex/getty/base.ex @@ -18,7 +18,9 @@ defmodule Authoritex.Getty.Base do @impl Authoritex def can_resolve?(unquote(http_uri) <> _id), do: true - def can_resolve?(unquote(prefix) <> _id), do: true + def can_resolve?(unquote(prefix) <> _ = id) do + unquote(prefix) != ":" + end def can_resolve?(_), do: false @impl Authoritex diff --git a/test/authoritex_test.exs b/test/authoritex_test.exs index 2157e75..cfb58c1 100644 --- a/test/authoritex_test.exs +++ b/test/authoritex_test.exs @@ -44,6 +44,11 @@ defmodule AuthoritexTest do assert Authoritex.fetch("info:fake/no-authority/12345") == {:error, :unknown_authority} end + + test "bad uri" do + assert Authoritex.fetch(":http://id.loc.gov/authorities/names/no2009131449") == + {:error, :unknown_authority} + end end describe "search/2" do