mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Fixed issue with host string and added internal url package
This commit is contained in:
parent
4444a1d299
commit
4597f63d12
7 changed files with 131 additions and 115 deletions
|
|
@ -3,10 +3,10 @@ package cmd
|
|||
import (
|
||||
"fmt"
|
||||
"os/user"
|
||||
"strings"
|
||||
|
||||
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||
"github.com/OpenCHAMI/magellan/internal/cache/sqlite"
|
||||
urlx "github.com/OpenCHAMI/magellan/internal/url"
|
||||
"github.com/OpenCHAMI/magellan/pkg/auth"
|
||||
"github.com/cznic/mathutil"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
|
@ -33,8 +33,10 @@ var collectCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
// URL sanitanization for host argument
|
||||
host = strings.TrimSuffix(host, "/")
|
||||
host = strings.ReplaceAll(host, "//", "/")
|
||||
host, err = urlx.Sanitize(host)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to sanitize host")
|
||||
}
|
||||
|
||||
// try to load access token either from env var, file, or config if var not set
|
||||
if accessToken == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue