This commit is contained in:
shoopea 2019-06-11 23:53:29 +08:00
parent 82800b4a0a
commit 6da33a53e4

7
job.go
View File

@ -6,6 +6,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
@ -548,12 +549,12 @@ func jobBackupImport(j Job) {
rc, err := f.Open() rc, err := f.Open()
logOnError(err, "jobBackupImport : Open") logOnError(err, "jobBackupImport : Open")
if err != nil { if err != nil {
return err return
} }
data, err := ioutil.ReadAll(rc) data, err := ioutil.ReadAll(rc)
logOnError(err, "jobBackupImport : ReadAll") logOnError(err, "jobBackupImport : ReadAll")
if err != nil { if err != nil {
return err return
} }
log.Printf("jobBackupImport : %d uncompressed bytes.\n", len(data)) log.Printf("jobBackupImport : %d uncompressed bytes.\n", len(data))
rc.Close() rc.Close()
@ -561,7 +562,7 @@ func jobBackupImport(j Job) {
err = json.Unmarshal(data, &bkp) err = json.Unmarshal(data, &bkp)
logOnError(err, "jobBackupImport : Unmarshal") logOnError(err, "jobBackupImport : Unmarshal")
if err != nil { if err != nil {
return err return
} }
for _, m := range bkp.Messages { for _, m := range bkp.Messages {
_, err = addObjMsg(m.ID64, m.ChatID64, m.UserID64, m.SenderUserID64, m.Date, m.Text) _, err = addObjMsg(m.ID64, m.ChatID64, m.UserID64, m.SenderUserID64, m.Date, m.Text)