diff options
| author | Emile Joubert <emile@rabbitmq.com> | 2012-09-06 18:01:24 +0100 |
|---|---|---|
| committer | Emile Joubert <emile@rabbitmq.com> | 2012-09-06 18:01:24 +0100 |
| commit | 837c741e45db6a7741fbf3df9726643559991fd1 (patch) | |
| tree | fe51cb12a8e583b40d93b6898ff2a783dac4f681 | |
| parent | fce079e8a7f074326bf1156e5e9158450bd4ab56 (diff) | |
| download | rabbitmq-server-git-837c741e45db6a7741fbf3df9726643559991fd1.tar.gz | |
Constrain policy regex patterns to binaries
| -rw-r--r-- | src/rabbit_parameter_validation.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rabbit_parameter_validation.erl b/src/rabbit_parameter_validation.erl index d421a33d02..c40104d7a2 100644 --- a/src/rabbit_parameter_validation.erl +++ b/src/rabbit_parameter_validation.erl @@ -36,12 +36,14 @@ list(_Name, Term) when is_list(Term) -> list(Name, Term) -> {error, "~s should be list, actually was ~p", [Name, Term]}. -regex(Name, Term) -> +regex(Name, Term) when is_binary(Term) -> case re:compile(Term) of {ok, _} -> ok; {error, Reason} -> {error, "~s should be regular expression " "but is invalid: ~p", [Name, Reason]} - end. + end; +regex(Name, Term) -> + {error, "~s should be a binary but was ~p", [Name, Term]}. proplist(Name, Constraints, Term) when is_list(Term) -> {Results, Remainder} |
