From c30ed44633976044f3b8964574cea9b4ff87bcaa Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 8 Oct 2024 18:05:06 -0400 Subject: [PATCH] feat(cmd/joj3): add quote to valid scopes --- cmd/joj3/conf/conf.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/joj3/conf/conf.go b/cmd/joj3/conf/conf.go index 193a118..1300dba 100644 --- a/cmd/joj3/conf/conf.go +++ b/cmd/joj3/conf/conf.go @@ -167,7 +167,9 @@ func ParseMsg(confRoot, confName, msg string) (conf Conf, group string, err erro func ListValidScopes(confRoot, confName string) ([]string, error) { confRoot = filepath.Clean(confRoot) validScopes := []string{} - err := filepath.Walk(confRoot, func(path string, info os.FileInfo, err error) error { + err := filepath.Walk(confRoot, func( + path string, info os.FileInfo, err error, + ) error { if err != nil { slog.Error("list valid scopes", "error", err) return err @@ -179,7 +181,11 @@ func ListValidScopes(confRoot, confName string) ([]string, error) { if err != nil { return err } - validScopes = append(validScopes, relPath) + if relPath == "." { + relPath = "" + } + validScopes = append(validScopes, + fmt.Sprintf("\"%s\"", relPath)) } } return nil