Check if host works first before assigning random host
This commit is contained in:
@@ -79,7 +79,7 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
|
||||
}
|
||||
if cfg.ShouldServeFromRclone() {
|
||||
if cfg.ShouldVerifyDownloadLink() {
|
||||
if !torMgr.Api.CanFetchFirstByte(unrestrict.Download) {
|
||||
if !dl.client.CanFetchFirstByte(unrestrict.Download) {
|
||||
log.Warnf("File %s is not available", fileName)
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
return
|
||||
@@ -123,7 +123,7 @@ func (dl *Downloader) DownloadLink(fileName, link string, resp http.ResponseWrit
|
||||
}
|
||||
if cfg.ShouldServeFromRclone() {
|
||||
if cfg.ShouldVerifyDownloadLink() {
|
||||
if !torMgr.Api.CanFetchFirstByte(unrestrict.Download) {
|
||||
if !dl.client.CanFetchFirstByte(unrestrict.Download) {
|
||||
log.Warnf("File %s is not available", fileName)
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user