Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func (s *Server) handleImageTransfer(ctx context.Context, srv cpb.Containerz_Dep
}

case *cpb.DeployRequest_ImageTransferEnd:
if chunkWriter.Size() == 0 {
// the client has not actually sent us anything.
return status.Errorf(codes.Aborted,
"no content was transferred over this stream")
}
if transfer.IsPlugin {
if err := moveFile(chunkWriter, filepath.Join(pluginLocation, fmt.Sprintf("%s.tar", transfer.GetName()))); err != nil {
return status.Errorf(codes.Internal, "unable to move plugin: %v", err)
Expand Down
14 changes: 14 additions & 0 deletions server/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,20 @@ func TestDeploy(t *testing.T) {
Tag: "some-tag",
}),
},
{
name: "no-data-sent",
inOpts: []Option{WithAddr("localhost:0"), WithChunkSize(8)},
inReqs: buildRequests(t, &cpb.ImageTransfer{
Name: "some-image",
Tag: "some-tag",
ImageSize: 16,
}, &cpb.ImageTransferEnd{}),
wantResponses: buildResponses(t, &cpb.ImageTransferReady{
ChunkSize: 8,
}),
wantErr: status.Errorf(codes.Aborted,
"no content was transferred over this stream"),
},
{
name: "too-much-data-sent",
inOpts: []Option{WithAddr("localhost:0"), WithChunkSize(8)},
Expand Down
Loading