summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-05-06 20:14:16 +0200
committerWim <wim@42.be>2018-05-06 20:14:16 +0200
commit467b373c43dfe5314d81a76032fbbf6b5f6917cc (patch)
tree18d7480390fddc291774bc4b633ab70b54ccec1a /gateway
parent72ce7f06e9bfc2a665f034f4099ed6eb79637f5c (diff)
downloadmatterbridge-msglm-467b373c43dfe5314d81a76032fbbf6b5f6917cc.tar.gz
matterbridge-msglm-467b373c43dfe5314d81a76032fbbf6b5f6917cc.tar.bz2
matterbridge-msglm-467b373c43dfe5314d81a76032fbbf6b5f6917cc.zip
Fix crash on invalid filenames
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index d6744cf7..42259d99 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -427,9 +427,13 @@ func (gw *Gateway) handleFiles(msg *config.Message) {
durl := gw.Config.General.MediaServerDownload + "/" + sha1sum + "/" + fi.Name
extra := msg.Extra["file"][i].(config.FileInfo)
extra.URL = durl
- req, _ := http.NewRequest("PUT", url, reader)
+ req, err := http.NewRequest("PUT", url, reader)
+ if err != nil {
+ flog.Errorf("mediaserver upload failed: %#v", err)
+ continue
+ }
req.Header.Set("Content-Type", "binary/octet-stream")
- _, err := client.Do(req)
+ _, err = client.Do(req)
if err != nil {
flog.Errorf("mediaserver upload failed: %#v", err)
continue