check status on upload, query escape cities for formatting maps uri format

This commit is contained in:
Bel LaPointe
2022-01-13 00:17:41 -05:00
parent 5170e96f7e
commit 1cc082083c
2 changed files with 8 additions and 2 deletions

View File

@@ -119,6 +119,11 @@ func (m Matrix) SendImage(uri string) error {
if err != nil {
return err
}
if response.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(response.Body)
response.Body.Close()
return fmt.Errorf("failed to get %s: (%d) %s", uri, response.StatusCode, b)
}
b, err := ioutil.ReadAll(response.Body)
response.Body.Close()
if err != nil {