Add error checks.

http_upload
Martin Dosch 4 years ago
parent 74967028d6
commit 6a781a7b97

@ -133,7 +133,10 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
iqContent := <-c
close(c)
xml.Unmarshal(iqContent.Query, &iqDiscoItemsXML)
err = xml.Unmarshal(iqContent.Query, &iqDiscoItemsXML)
if err != nil {
log.Fatal(err)
}
// Check the services reported by disco#items for the http upload service
for _, r := range iqDiscoItemsXML.Item {
@ -147,7 +150,10 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
iqDiscoInfo := <-c
close(c)
xml.Unmarshal(iqDiscoInfo.Query, &iqDiscoInfoXML)
err = xml.Unmarshal(iqDiscoInfo.Query, &iqDiscoInfoXML)
if err != nil {
log.Fatal(err)
}
if iqDiscoInfoXML.Identity.Type == "file" && iqDiscoInfoXML.Identity.Category == "store" {
uploadComponent = r.Jid
@ -172,7 +178,10 @@ func httpUpload(client *xmpp.Client, jserver string, filePath string) string {
}
uploadSlot := <-c
close(c)
xml.Unmarshal(uploadSlot.Query, &iqHttpUploadSlotXML)
err = xml.Unmarshal(uploadSlot.Query, &iqHttpUploadSlotXML)
if err != nil {
log.Fatal(err)
}
// Upload file
httpClient := &http.Client{}

Loading…
Cancel
Save