Skip to content

Commit

Permalink
fix: join url paths properly to build browser URL to open (#4040)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnogueira authored Oct 7, 2024
1 parent 9673f4f commit 9e293f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion agent/runner/runstrategy_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package runner
import (
"context"
"fmt"
"net/url"

agentConfig "github.com/kubeshop/tracetest/agent/config"
"github.com/kubeshop/tracetest/agent/ui/dashboard/sensors"
Expand All @@ -27,7 +28,12 @@ You can`
{
Text: "Open Tracetest in a browser to this environment",
Fn: func(_ consoleUI.ConsoleUI) {
s.ui.OpenBrowser(fmt.Sprintf("%sorganizations/%s/environments/%s", uiEndpoint, claims["organization_id"], claims["environment_id"]))
endpoint, err := url.JoinPath(uiEndpoint, fmt.Sprintf("/organizations/%s/environments/%s", claims["organization_id"], claims["environment_id"]))
if err != nil {
s.ui.Exit(fmt.Errorf("could not create URL: %w", err).Error())
}

s.ui.OpenBrowser(endpoint)
},
},
{
Expand Down

0 comments on commit 9e293f2

Please sign in to comment.