Fix crash on invalid filenames

This commit is contained in:
Wim 2018-05-06 20:14:16 +02:00
parent 72ce7f06e9
commit 467b373c43

View File

@ -427,9 +427,13 @@ func (gw *Gateway) handleFiles(msg *config.Message) {
durl := gw.Config.General.MediaServerDownload + "/" + sha1sum + "/" + fi.Name durl := gw.Config.General.MediaServerDownload + "/" + sha1sum + "/" + fi.Name
extra := msg.Extra["file"][i].(config.FileInfo) extra := msg.Extra["file"][i].(config.FileInfo)
extra.URL = durl 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") req.Header.Set("Content-Type", "binary/octet-stream")
_, err := client.Do(req) _, err = client.Do(req)
if err != nil { if err != nil {
flog.Errorf("mediaserver upload failed: %#v", err) flog.Errorf("mediaserver upload failed: %#v", err)
continue continue