From 467b373c43dfe5314d81a76032fbbf6b5f6917cc Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 6 May 2018 20:14:16 +0200 Subject: Fix crash on invalid filenames --- gateway/gateway.go | 8 ++++++-- 1 file 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 -- cgit v1.2.3