Skip to content

Commit 5b8fe3f

Browse files
committed
fix: 修复windows rsa 证书生成路径获取错误
1 parent 08647f5 commit 5b8fe3f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

common/function/docker.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"io"
88
"log/slog"
9+
"runtime"
910
"strings"
1011

1112
"github.com/distribution/reference"
@@ -17,6 +18,10 @@ import (
1718

1819
func SplitCommandArray(cmd string) []string {
1920
result := make([]string, 0)
21+
if runtime.GOOS == "windows" {
22+
// windows 中需要将路径再次转义一下,防止 parade 之后没有分隔符
23+
cmd = strings.ReplaceAll(cmd, "\\", "\\\\")
24+
}
2025
result, err := shellwords.Parse(cmd)
2126
if err != nil {
2227
slog.Debug("function split command array ", "error", err)

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func initRSA() error {
299299
_ = os.Remove(file)
300300
}
301301
_, err := local.QuickRun(fmt.Sprintf(
302-
`ssh-keygen -t rsa -b 4096 -f %s -N "" -C "%s@%s"`,
302+
`ssh-keygen -t rsa -b 4096 -f "%s" -N "" -C "%s@%s"`,
303303
filepath.Join(storage.Local{}.GetCertRsaPath(), define.DefaultIdKeyFile),
304304
define.PanelAuthor,
305305
define.PanelWebSite,

0 commit comments

Comments
 (0)