Skip to content

Commit

Permalink
Merge pull request #272 from shirou/fix/topicalias_handler_set_alias
Browse files Browse the repository at this point in the history
Fix the topic disappear when registering a new topic alias in the TAHandler
  • Loading branch information
MattBrittan authored Nov 13, 2024
2 parents dfcd15e + 8bd9663 commit 6737a47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion paho/extensions/topicaliases/topicliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func (t *TAHandler) PublishHook(p *paho.Publish) {
p.Properties = &paho.PublishProperties{}
}
p.Properties.TopicAlias = paho.Uint16(a)
p.Topic = ""
return
}
}
2 changes: 2 additions & 0 deletions paho/extensions/topicaliases/topicliases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestTAHandler_PublishHook(t *testing.T) {
Topic: "test",
},
expected: &paho.Publish{
Topic: "test",
Properties: &paho.PublishProperties{
TopicAlias: paho.Uint16(1),
},
Expand All @@ -86,6 +87,7 @@ func TestTAHandler_PublishHook(t *testing.T) {
Properties: &paho.PublishProperties{},
},
expected: &paho.Publish{
Topic: "test",
Properties: &paho.PublishProperties{
TopicAlias: paho.Uint16(1),
},
Expand Down

0 comments on commit 6737a47

Please sign in to comment.