feat(cmd/joj3): add quote to valid scopes
All checks were successful
submodules sync / sync (push) Successful in 32s
build / build (push) Successful in 2m4s
build / trigger-build-image (push) Successful in 6s

This commit is contained in:
张泊明518370910136 2024-10-08 18:05:06 -04:00
parent b799c15248
commit c30ed44633
GPG Key ID: D47306D7062CDA9D

View File

@ -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