Close download body

This commit is contained in:
Ben Sarmiento
2024-01-24 05:34:06 +01:00
parent efa145b046
commit 0956dd7537

View File

@@ -178,6 +178,8 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
return
}
defer download.Body.Close()
if download.StatusCode != http.StatusOK && download.StatusCode != http.StatusPartialContent {
if file != nil && unrestrict.Streamable == 1 {
log.Warnf("Received a %s status code for file %s", download.Status, file.Path)