From 1fbb36c34aefcd835b2d742cfccebeabec674c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Fri, 29 Jun 2018 11:13:16 +0200 Subject: [PATCH] Fix misc:try_url for erlang < R20 --- src/misc.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc.erl b/src/misc.erl index 7aaebffc9..2e1b3f008 100644 --- a/src/misc.erl +++ b/src/misc.erl @@ -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]),