Identify broken links properly
This commit is contained in:
@@ -56,6 +56,7 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
|
||||
if unrestrict == nil {
|
||||
log.Warnf("File %s cannot be unrestricted (link=%s)", fileName, link)
|
||||
if cfg.EnableRepair() {
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
@@ -159,6 +160,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
||||
if file != nil && unrestrict.Streamable == 1 {
|
||||
log.Warnf("Cannot download file %s: %v", file.Path, err)
|
||||
if cfg.EnableRepair() && torrent != nil {
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
@@ -174,6 +176,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
||||
if file != nil && unrestrict.Streamable == 1 {
|
||||
log.Warnf("Received a %s status code for file %s", download.Status, file.Path)
|
||||
if cfg.EnableRepair() && torrent != nil {
|
||||
torrent.BrokenLinks.Add(file.Link)
|
||||
file.Link = "repair"
|
||||
torMgr.Repair(torrent)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user