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

Method ResolveSavePath

shortcuts/common/runner.go:573–586  ·  view source on GitHub ↗

ResolveSavePath resolves a relative path to a validated absolute path via FileIO.ResolvePath. It returns an error if no FileIO provider is registered or if the path fails validation (e.g. traversal, symlink escape).

(path string)

Source from the content-addressed store, hash-verified

571// FileIO.ResolvePath. It returns an error if no FileIO provider is registered
572// or if the path fails validation (e.g. traversal, symlink escape).
573func (ctx *RuntimeContext) ResolveSavePath(path string) (string, error) {
574 fio := ctx.FileIO()
575 if fio == nil {
576 return "", fmt.Errorf("no file I/O provider registered")
577 }
578 resolved, err := fio.ResolvePath(path)
579 if err != nil {
580 return "", fmt.Errorf("resolve save path: %w", err)
581 }
582 if resolved == "" {
583 return "", fmt.Errorf("resolve save path: empty result for %q", path)
584 }
585 return resolved, nil
586}
587
588// WrapOpenError matches a FileIO.Open/Stat error and wraps it with the
589// caller-provided message prefix.

Calls 2

FileIOMethod · 0.95
ResolvePathMethod · 0.65

Tested by

no test coverage detected