fix(utils): denote `emqx_jsonish` follows access module behaviour

Defined in `emqx_template`.
This commit is contained in:
Andrew Mayorov 2023-11-02 15:40:20 +07:00
parent b5b6c3f8cc
commit e521a9f5fc
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 3 additions and 2 deletions

View File

@ -16,6 +16,7 @@
-module(emqx_jsonish).
-behaviour(emqx_template).
-export([lookup/2]).
-export_type([t/0]).
@ -53,11 +54,11 @@ lookup(Loc, Decoded, [Prop | Rest], Jsonish) when is_map(Jsonish) ->
{error, Reason} ->
{error, Reason}
end;
lookup(Loc, _Decoded = false, Rest, Json) when is_binary(Json) ->
lookup(Loc, _Decoded = false, Props, Json) when is_binary(Json) ->
try emqx_utils_json:decode(Json) of
Value ->
% NOTE: This is intentional, we don't want to parse nested JSON.
lookup(Loc, true, Rest, Value)
lookup(Loc, true, Props, Value)
catch
error:_ ->
{error, {Loc, binary}}