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

@@ -14,8 +14,9 @@ COPY --from=builder /app/zurg .
COPY ./healthcheck.sh /app/healthcheck.sh COPY ./healthcheck.sh /app/healthcheck.sh
RUN chmod +x /app/healthcheck.sh RUN chmod +x /app/healthcheck.sh
COPY config.example.yml /app/config.yml COPY config.example.yml /app/config.yml
# Install runtime dependencies and configure FUSE # Install runtime dependencies and configure FUSE
RUN apk add curl python3 libxml2-utils RUN apk add --no-cache curl python3 libxml2-utils ffmpeg
HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=10 CMD /app/healthcheck.sh HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=10 CMD /app/healthcheck.sh

View File

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