From 5ab985f2e529d562c9327106939b8bdbc6dea247 Mon Sep 17 00:00:00 2001 From: Daniil Poroshin Date: Wed, 6 Nov 2024 14:02:11 +0400 Subject: [PATCH] fix: invalid path for devices commands --- internal/app/enaptercli/cmd_devices.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/app/enaptercli/cmd_devices.go b/internal/app/enaptercli/cmd_devices.go index 56d88eb..7b31d72 100644 --- a/internal/app/enaptercli/cmd_devices.go +++ b/internal/app/enaptercli/cmd_devices.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "net/url" "github.com/urfave/cli/v2" ) @@ -38,7 +39,11 @@ func (c *cmdDevices) Flags() []cli.Flag { } func (c *cmdDevices) doHTTPRequest(ctx context.Context, p doHTTPRequestParams) error { - p.Path = "/devices/" + c.deviceID + path, err := url.JoinPath("/devices", c.deviceID, p.Path) + if err != nil { + return fmt.Errorf("join path: %w", err) + } + p.Path = path return c.cmdBase.doHTTPRequest(ctx, p) }