MCPcopy
hub / github.com/mudler/LocalAI / VerifyPath

Function VerifyPath

pkg/utils/path.go:26–29  ·  view source on GitHub ↗

VerifyPath verifies that path is based in basePath.

(path, basePath string)

Source from the content-addressed store, hash-verified

24
25// VerifyPath verifies that path is based in basePath.
26func VerifyPath(path, basePath string) error {
27 c := filepath.Clean(filepath.Join(basePath, path))
28 return InTrustedRoot(c, filepath.Clean(basePath))
29}
30
31// SanitizeFileName sanitizes the given filename
32func SanitizeFileName(fileName string) string {

Callers 15

LoadMethod · 0.92
ImportModelEndpointFunction · 0.92
ModelTTSFunction · 0.92
ModelTTSStreamFunction · 0.92
loadTemplateIfExistsMethod · 0.92
ImportModelMethod · 0.92
ExportModelMethod · 0.92
TogglePinnedMethod · 0.92
ToggleStateMethod · 0.92
GetConfigMethod · 0.92
PatchConfigMethod · 0.92
EditYAMLMethod · 0.92

Calls 1

InTrustedRootFunction · 0.85

Tested by

no test coverage detected