mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
* feat: add FileIO extension for file transfer abstraction Introduce extension/fileio package with Provider/FileIO/File interfaces and a global registry, following the same pattern as extension/credential. - Add LocalFileIO default implementation with path validation and atomic writes - Wire FileIOProvider into Factory and resolve at runtime via RuntimeContext.FileIO() - Factory holds Provider (not resolved instance), deferring resolution to execution time
31 lines
1022 B
Go
31 lines
1022 B
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package validate
|
|
|
|
import "github.com/larksuite/cli/internal/vfs/localfileio"
|
|
|
|
// SafeOutputPath validates a download/export target path.
|
|
// Delegates to localfileio.SafeOutputPath.
|
|
func SafeOutputPath(path string) (string, error) {
|
|
return localfileio.SafeOutputPath(path)
|
|
}
|
|
|
|
// SafeInputPath validates an upload/read source path.
|
|
// Delegates to localfileio.SafeInputPath.
|
|
func SafeInputPath(path string) (string, error) {
|
|
return localfileio.SafeInputPath(path)
|
|
}
|
|
|
|
// SafeEnvDirPath validates an environment-provided application directory path.
|
|
// Delegates to localfileio.SafeEnvDirPath.
|
|
func SafeEnvDirPath(path, envName string) (string, error) {
|
|
return localfileio.SafeEnvDirPath(path, envName)
|
|
}
|
|
|
|
// SafeLocalFlagPath validates a flag value as a local file path.
|
|
// Delegates to localfileio.SafeLocalFlagPath.
|
|
func SafeLocalFlagPath(flagName, value string) (string, error) {
|
|
return localfileio.SafeLocalFlagPath(flagName, value)
|
|
}
|