Skip to content

Commit d4b5649

Browse files
committed
[FAB-2341] Fix validation logic with empty CodePackage
The recently added platform::ValidateDeploymentSpec did not account for the possibility that the CodePackage may be optional under certain scenarios. This patch fixes this by checking for this condition and handling gracefully. Fixes FAB-2341 Change-Id: I83791dbf04c420e42b087805de668f0405b0214a Signed-off-by: Greg Haskins <[email protected]>
1 parent 22795e3 commit d4b5649

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/chaincode/platforms/golang/platform.go

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ func (goPlatform *Platform) ValidateSpec(spec *pb.ChaincodeSpec) error {
9898

9999
func (goPlatform *Platform) ValidateDeploymentSpec(cds *pb.ChaincodeDeploymentSpec) error {
100100

101+
if cds.CodePackage == nil || len(cds.CodePackage) == 0 {
102+
// Nothing to validate if no CodePackage was included
103+
return nil
104+
}
105+
101106
// FAB-2122: Scan the provided tarball to ensure it only contains source-code under
102107
// /src/$packagename. We do not want to allow something like ./pkg/shady.a to be installed under
103108
// $GOPATH within the container. Note, we do not look deeper than the path at this time

0 commit comments

Comments
 (0)