MCPcopy
hub / github.com/hyperledger/fabric / ValidateLabel

Function ValidateLabel

core/chaincode/persistence/chaincode_package.go:251–257  ·  view source on GitHub ↗

ValidateLabel return an error if the provided label contains any invalid characters, as determined by LabelRegexp.

(label string)

Source from the content-addressed store, hash-verified

249// ValidateLabel return an error if the provided label contains any invalid
250// characters, as determined by LabelRegexp.
251func ValidateLabel(label string) error {
252 if !LabelRegexp.MatchString(label) {
253 return errors.Errorf("invalid label '%s'. Label must be non-empty, can only consist of alphanumerics, symbols from '.+-_', and can only begin with alphanumerics", label)
254 }
255
256 return nil
257}
258
259// Parse parses a set of bytes as a chaincode package
260// and returns the parsed package as a struct

Callers 3

ValidateMethod · 0.92
TestLabelsFunction · 0.85
ParseChaincodePackageFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestLabelsFunction · 0.68