upload/koji: handle the unmarshalling error

This commit is contained in:
Ondřej Budai 2020-05-14 12:08:59 +02:00 committed by Tom Gundersen
parent 0c87a7f524
commit 184cd24426

View file

@ -248,7 +248,11 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
Size int `xmlrpc:"size"`
Adler32 string `xmlrpc:"hexdigest"`
}
xmlrpc.Response.Unmarshal(body, &reply)
err = xmlrpc.Response.Unmarshal(body, &reply)
if err != nil {
return fmt.Errorf("cannot unmarshal the xmlrpc response: %v", err)
}
if reply.Size != len(chunk) {
return fmt.Errorf("Sent a chunk of %d bytes, but server got %d bytes", len(chunk), reply.Size)