MCPcopy Index your code
hub / github.com/docker/cli / isValidFilePath

Function isValidFilePath

cli/context/store/store.go:371–382  ·  view source on GitHub ↗
(p string)

Source from the content-addressed store, hash-verified

369}
370
371func isValidFilePath(p string) error {
372 if p != metaFile && !strings.HasPrefix(p, "tls/") {
373 return errors.New("unexpected context file")
374 }
375 if path.Clean(p) != p {
376 return errors.New("unexpected path format")
377 }
378 if strings.Contains(p, `\`) {
379 return errors.New(`unexpected '\' in path`)
380 }
381 return nil
382}
383
384func importTar(name string, s Writer, reader io.Reader) error {
385 tr := tar.NewReader(&limitedReader{R: reader, N: maxAllowedFileSizeToImport})

Callers 3

importTarFunction · 0.85
importZipFunction · 0.85
TestValidFilePathsFunction · 0.85

Calls 1

ContainsMethod · 0.80

Tested by 1

TestValidFilePathsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…