mirror of
https://github.com/larksuite/cli.git
synced 2026-08-03 08:32:46 +08:00
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
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)
|
|
}
|
|
|
|
// LocalInputPath validates a local input path without restricting it to the
|
|
// current working directory. It delegates to localfileio.LocalInputPath so
|
|
// command validation and shared local-file readers use one policy.
|
|
func LocalInputPath(path string) (string, error) {
|
|
return localfileio.LocalInputPath(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)
|
|
}
|