Unable publish event with empty space name when using MQTT as message bus
weichou1229 opened this issue Β· comments
π Bug Report
Affected Services [REQUIRED]
The issue is located in: device serviceIs this a regression?
NoDescription and Minimal Reproduction [REQUIRED]
If the event sourceName contains empty space like test resource
, the SDK can't publish the event because the common.URLEncode(event.SourceName) method encodes the empty space to plus sign +
.
for example,
edgex/events/device/device-simple/Simple-Device/Simple-Device01/Counter+test
the plus sign ( + ) cannot be used in MQTT publish topic.
To solve this issue, we should use url.PathEncode instead.
π₯ Exception or Error
π Your Environment
Deployment Environment:
EdgeX Version [REQUIRED]:
Main branch
Anything else relevant?
- core-contracts edgexfoundry/go-mod-core-contracts#806
- device-sdk #1335
- edgex-go edgexfoundry/edgex-go#4376
fixed by the above merged PRs