Fix issue with range loop

This commit is contained in:
Ben Sarmiento
2024-05-26 00:53:11 +02:00
parent 66dd32a37d
commit bc85c21209
2 changed files with 10 additions and 9 deletions

View File

@@ -317,16 +317,16 @@ func (t *TorrentManager) deleteInfoFile(torrentID string) {
func (t *TorrentManager) mountNewDownloads() {
downloads := t.api.GetDownloads()
for _, download := range downloads {
isRealDebrid := strings.HasPrefix(download.Link, "https://real-debrid.com/d/")
if isRealDebrid && !t.UnrestrictMap.Has(download.Link[0:39]) {
t.UnrestrictMap.Set(download.Link[0:39], &download)
for i := range downloads {
isRealDebrid := strings.HasPrefix(downloads[i].Link, "https://real-debrid.com/d/")
if isRealDebrid && !t.UnrestrictMap.Has(downloads[i].Link[0:39]) {
t.UnrestrictMap.Set(downloads[i].Link[0:39], &downloads[i])
} else if !isRealDebrid {
if !t.UnrestrictMap.Has(download.Link) {
t.UnrestrictMap.Set(download.Link, &download)
if !t.UnrestrictMap.Has(downloads[i].Link) {
t.UnrestrictMap.Set(downloads[i].Link, &downloads[i])
}
filename := filepath.Base(download.Filename)
t.DownloadMap.Set(filename, &download)
filename := filepath.Base(downloads[i].Filename)
t.DownloadMap.Set(filename, &downloads[i])
}
}
}