MCPcopy Create free account
hub / github.com/bufbuild/buf / validateFileNodeParameters

Function validateFileNodeParameters

private/pkg/cas/file_node.go:119–134  ·  view source on GitHub ↗
(path string, digest Digest)

Source from the content-addressed store, hash-verified

117func (*fileNode) isFileNode() {}
118
119func validateFileNodeParameters(path string, digest Digest) error {
120 if path == "" {
121 return errors.New("path was empty")
122 }
123 normalizedPath, err := normalpath.NormalizeAndValidate(path)
124 if err != nil {
125 return fmt.Errorf("path %q was not valid: %w", path, err)
126 }
127 if path != normalizedPath {
128 return fmt.Errorf("path %q was not equal to normalized path %q", path, normalizedPath)
129 }
130 if digest == nil {
131 return errors.New("no digest specified")
132 }
133 return nil
134}

Callers 2

NewFileNodeFunction · 0.85
ParseFileNodeFunction · 0.85

Calls 1

NormalizeAndValidateFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…