]> granicus.if.org Git - ejabberd/commitdiff
Fix misc:try_url for erlang < R20
authorPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 29 Jun 2018 09:13:16 +0000 (11:13 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 29 Jun 2018 09:13:29 +0000 (11:13 +0200)
src/misc.erl

index 7aaebffc9e3d8518f35fb02e702beda794b4cc8c..2e1b3f0085705366bee0db0469921c3d868312c2 100644 (file)
@@ -223,7 +223,11 @@ try_read_file(Path) ->
 %%      Fails with `badarg` otherwise. The function is intended for usage
 %%      in configuration validators only.
 -spec try_url(binary() | string()) -> binary().
-try_url(URL) ->
+try_url(URL0) ->
+    URL = case URL0 of
+       V when is_binary(V) -> binary_to_list(V);
+       _ -> URL0
+    end,
     case http_uri:parse(URL) of
        {ok, {Scheme, _, _, _, _, _}} when Scheme /= http, Scheme /= https ->
            ?ERROR_MSG("Unsupported URI scheme: ~s", [URL]),