From 0e504d02a40fbd3d75240bcc9ddbbb86be0e5025 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Wed, 29 Jul 2015 23:39:03 -0400 Subject: [PATCH] fix the weird list/binary behavior --- src/autocluster_consul.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/autocluster_consul.erl b/src/autocluster_consul.erl index 3ecbb5b..3eea08e 100644 --- a/src/autocluster_consul.erl +++ b/src/autocluster_consul.erl @@ -187,7 +187,12 @@ host_sname(Value) -> Parts = string:tokens(binary_to_list(Value), "."), case length(Parts) of 1 -> binary_to_list(Value); - _ -> binary_to_list(lists:nth(1, Parts)) + _ -> + SName = lists:nth(1, Parts), + case is_list(SName) of + true -> SName; + false -> binary_to_list(SName) + end end.