Skip to content

Commit

Permalink
Put the validated topic into the message, this fixes retained message…
Browse files Browse the repository at this point in the history
… publishing
  • Loading branch information
mmzeeman committed Jul 23, 2023
1 parent cd61698 commit 8172868
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mqtt_sessions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ publish(Pool, #{ type := publish, topic := Topic } = Msg, UserContext) when is_a
case mqtt_packet_map_topic:validate_topic_publish(Topic) of
{ok, TopicValidated} ->
Runtime = runtime(),
case Runtime:is_allowed(publish, TopicValidated, Msg, UserContext) of
MsgValidatedTopic = Msg#{ topic => TopicValidated },
case Runtime:is_allowed(publish, TopicValidated, MsgValidatedTopic, UserContext) of
true ->
case mqtt_sessions_router:publish(Pool, TopicValidated, Msg, UserContext) of
case mqtt_sessions_router:publish(Pool, TopicValidated, MsgValidatedTopic, UserContext) of
{ok, _Pid} -> ok;
{error, _} = Error -> Error
end;
Expand Down

0 comments on commit 8172868

Please sign in to comment.