Skip to content

Commit 6a2a1f3

Browse files
Tomas Kubovickuby
authored andcommitted
Added trim [] for IPv6 address in getDeviceByIP method
1 parent 53af79e commit 6a2a1f3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

client/getDevice.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"crypto/x509"
2222
"errors"
2323
"fmt"
24+
"strings"
2425

2526
"github.com/plgd-dev/device/v2/client/core"
2627
"github.com/plgd-dev/device/v2/schema"
@@ -81,7 +82,7 @@ func (c *Client) GetDeviceByMulticast(ctx context.Context, deviceID string, opts
8182
}
8283

8384
func (c *Client) getDeviceByIP(ctx context.Context, ip string, expectedDeviceID string) (*core.Device, schema.ResourceLinks, error) {
84-
dev, err := c.getDeviceByIPWithUpdateCache(ctx, ip, expectedDeviceID)
85+
dev, err := c.getDeviceByIPWithUpdateCache(ctx, strings.Trim(ip, "[]"), expectedDeviceID)
8586
if err != nil {
8687
return nil, nil, err
8788
}

0 commit comments

Comments
 (0)