diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 49033fc3a..c7ce7485d 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -140,16 +140,19 @@ public class WebDataHandler extends BaseDataHandler { request = request.replace("{gprmc}", formatSentence(position)); } - String deviceGroupName = ""; - - if (device.getGroupId() != 0) { - Group group = Context.getGroupsManager().getById(device.getGroupId()); - if (group != null) { + if (request.contains("{group}")) { + String deviceGroupName = ""; + if (device.getGroupId() != 0) { + Group group = Context.getGroupsManager().getById(device.getGroupId()); + if (group != null) { deviceGroupName = group.getName(); + } } + + request = request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); } - return request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); + return request; } @Override |