Do not repair invalid download code error

This commit is contained in:
Ben Adrian Sarmiento
2024-07-01 03:37:04 +02:00
parent 99ca9d2602
commit b5fa74bd69
3 changed files with 17 additions and 6 deletions

View File

@@ -171,8 +171,10 @@ func (dl *Downloader) streamFileToResponse(
// log.Errorf("Your account has reached the bandwidth limit, please try again after 12AM CET")
http.Error(resp, "File is not available (bandwidth limit reached)", http.StatusBadRequest)
return
}
if err != nil {
} else if utils.IsInvalidDownloadCode(err) {
http.Error(resp, "File is not available (invalid download code)", http.StatusInternalServerError)
return
} else if err != nil {
log.Errorf("Cannot download file %s: %v", unrestrict.Download, err)
if file != nil && file.State.Event(context.Background(), "break_file") == nil {
torMgr.EnqueueForRepair(torrent)