Skip to content

Commit 5566a1d

Browse files
committed
修复以根路径/开头的路径被加 wd 前缀的问题
1 parent a6cf586 commit 5566a1d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cmd/root.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"net/rpc"
1515
"os"
1616
"path/filepath"
17+
"strings"
1718
"time"
1819

1920
"github.com/hashicorp/yamux"
@@ -48,7 +49,11 @@ var rootCmd = &cobra.Command{
4849
wd := try.To1(os.Getwd())
4950
var allow = make([]string, len(files))
5051
for i, f := range files {
51-
allow[i] = filepath.Join(wd, f)
52+
if strings.HasPrefix(f, "/") {
53+
allow[i] = f
54+
} else {
55+
allow[i] = filepath.Join(wd, f)
56+
}
5257
}
5358

5459
func() {

0 commit comments

Comments
 (0)