fix: validatePath now returns an error when the workspace is empty.

This commit is contained in:
0x5487 2026-02-22 22:20:43 +08:00
parent b8b3f117f1
commit 74a0ff84a9

View file

@ -13,7 +13,7 @@ import (
// validatePath ensures the given path is within the workspace if restrict is true. // validatePath ensures the given path is within the workspace if restrict is true.
func validatePath(path, workspace string, restrict bool) (string, error) { func validatePath(path, workspace string, restrict bool) (string, error) {
if workspace == "" { if workspace == "" {
return path, nil return path, fmt.Errorf("workspace is not defined")
} }
absWorkspace, err := filepath.Abs(workspace) absWorkspace, err := filepath.Abs(workspace)