This commit is contained in:
shoopea 2019-06-09 22:46:24 +08:00
parent 7e5c85837f
commit 1f0758e683

14
msg.go
View File

@ -340,9 +340,19 @@ func UnzipMessages(z []byte) error {
if err != nil {
return err
}
bkp := DataBackup{}
err = json.NewDecoder(rc).Decode(bkp)
data, err := ioutil.ReadAll(rc)
logOnError(err, "UnzipMessages : ReadAll")
if err != nil {
return err
}
log.Printf("UnzipMessages : %d uncompressed bytes.\n", len(data))
rc.Close()
bkp := DataBackup{}
err = json.Unmarshal(data, &bkp)
logOnError(err, "UnzipMessages : Unmarshal")
if err != nil {
return err
}
log.Printf("UnzipMessages : %d messages.\n", len(bkp.Messages))
return nil
}