summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/couch/src/couch_util.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl
index e3867afdb..184acc379 100644
--- a/src/couch/src/couch_util.erl
+++ b/src/couch/src/couch_util.erl
@@ -298,6 +298,9 @@ is_whitespace(_Else) -> false.
% removes leading and trailing whitespace from a string
+trim(String) when is_binary(String) ->
+ % mirror string:trim() behaviour of returning a binary when a binary is passed in
+ ?l2b(trim(?b2l(String)));
trim(String) ->
String2 = lists:dropwhile(fun is_whitespace/1, String),
lists:reverse(lists:dropwhile(fun is_whitespace/1, lists:reverse(String2))).