Do not unrestrict files that are marked as broken until it is fixed

This commit is contained in:
Ben Sarmiento
2024-02-20 11:32:48 +01:00
parent 15332779e3
commit 6d7c639125
3 changed files with 12 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
return
}
unrestrict := torMgr.UnrestrictUntilOk(file.Link)
unrestrict := torMgr.UnrestrictFileUntilOk(file)
if unrestrict == nil {
file.IsBroken = true
if cfg.EnableRepair() {
@@ -91,7 +91,7 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
// DownloadLink handles a GET request for downloads
func (dl *Downloader) DownloadLink(fileName, link string, resp http.ResponseWriter, req *http.Request, torMgr *intTor.TorrentManager, cfg config.ConfigInterface, log *logutil.Logger) {
// log.Debugf("Opening file %s (%s)", fileName, link)
unrestrict := torMgr.UnrestrictUntilOk(link)
unrestrict := torMgr.UnrestrictLinkUntilOk(link)
if unrestrict == nil {
log.Warnf("File %s cannot be unrestricted (link=%s)", fileName, link)
http.Error(resp, "File is not available", http.StatusInternalServerError)