fix cmd/picoclaw/cmd_status.go:158:12: host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf (nosprintfhostport)

This commit is contained in:
likeaturtle 2026-02-21 00:23:44 +08:00
parent c758a074ad
commit 14a95c9ffb

View file

@ -5,7 +5,9 @@ package main
import ( import (
"fmt" "fmt"
"net"
"os" "os"
"strconv"
"strings" "strings"
"github.com/sipeed/picoclaw/pkg/auth" "github.com/sipeed/picoclaw/pkg/auth"
@ -155,7 +157,8 @@ func statusCmd() {
channelStatus(cfg.Channels.OneBot.Enabled, "OneBot") channelStatus(cfg.Channels.OneBot.Enabled, "OneBot")
channelStatus(cfg.Channels.MaixCam.Enabled, "MaixCam") channelStatus(cfg.Channels.MaixCam.Enabled, "MaixCam")
if cfg.Channels.WebSocket.Enabled { if cfg.Channels.WebSocket.Enabled {
addr := fmt.Sprintf("http://%s:%d", cfg.Channels.WebSocket.Host, cfg.Channels.WebSocket.Port) hostPort := net.JoinHostPort(cfg.Channels.WebSocket.Host, strconv.Itoa(cfg.Channels.WebSocket.Port))
addr := "http://" + hostPort
channelStatus(true, "WebSocket", addr) channelStatus(true, "WebSocket", addr)
} else { } else {
channelStatus(false, "WebSocket") channelStatus(false, "WebSocket")