Bug fixes

This commit is contained in:
Ben Adrian Sarmiento
2024-06-28 20:18:30 +02:00
parent f8f31b3b67
commit 7cd8c9e5c9
4 changed files with 25 additions and 8 deletions

View File

@@ -84,12 +84,17 @@ func (dl *Downloader) DownloadFile(
}
file, ok := torrent.SelectedFiles.Get(fileName)
if !ok || !file.State.Is("ok_file") {
if !ok || file.State.Is("deleted_file") {
log.Errorf("Cannot find file %s from path %s", fileName, req.URL.Path)
http.Error(resp, "File not found", http.StatusNotFound)
return
}
if file.State.Is("broken_file") {
http.Error(resp, "File is not available (being repaired)", http.StatusNotFound)
return
}
unrestrict, err := torMgr.UnrestrictFile(file)
if utils.AreAllTokensExpired(err) {
// log.Errorf("Your account has reached the bandwidth limit, please try again after 12AM CET")