MCPcopy
hub / github.com/larksuite/cli / ValidatePath

Method ValidatePath

shortcuts/common/runner.go:655–664  ·  view source on GitHub ↗

ValidatePath checks that path is a valid relative input path within the working directory by delegating to FileIO.Stat. Returns nil if the path is valid or does not exist yet; returns an error only for illegal paths (absolute, traversal, symlink escape, control chars). NOTE: This validates input (r

(path string)

Source from the content-addressed store, hash-verified

653// the FileIO implementation. For output (write) path validation, use
654// ResolveSavePath instead.
655func (ctx *RuntimeContext) ValidatePath(path string) error {
656 fio := ctx.FileIO()
657 if fio == nil {
658 return fmt.Errorf("no file I/O provider registered")
659 }
660 if _, err := fio.Stat(path); err != nil && !os.IsNotExist(err) {
661 return err
662 }
663 return nil
664}
665
666// ── Output helpers ──
667

Callers 2

loadPatchFileFunction · 0.80
mail_lint_html.goFile · 0.80

Calls 2

FileIOMethod · 0.95
StatMethod · 0.65

Tested by

no test coverage detected