Additional fixes on link checks
This commit is contained in:
@@ -141,10 +141,10 @@ func (t *TorrentManager) mergeToMain(mainTorrent, torrentToMerge *Torrent) *Torr
|
||||
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
|
||||
} else {
|
||||
// if it exists, compare the LatestAdded property and the link
|
||||
if mainTorrent.LatestAdded < torrentToMerge.LatestAdded && fileToMerge.Link != "" {
|
||||
if mainTorrent.LatestAdded < torrentToMerge.LatestAdded && strings.HasPrefix(fileToMerge.Link, "http") {
|
||||
// if torrentToMerge is more recent and its file has a link, update the main torrent's file
|
||||
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
|
||||
} else if mainFile.Link == "" && fileToMerge.Link != "" {
|
||||
} else if !strings.HasPrefix(mainFile.Link, "http") && strings.HasPrefix(fileToMerge.Link, "http") {
|
||||
// if the main torrent's file link is empty and t2's file has a link, even if it's older, update it
|
||||
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
|
||||
}
|
||||
@@ -590,7 +590,7 @@ func (t *TorrentManager) Repair(accessKey string) {
|
||||
ZurgFS: file.ZurgFS,
|
||||
}
|
||||
selectedFiles = append(selectedFiles, fileCopy)
|
||||
if fileCopy.Link != "" {
|
||||
if strings.HasPrefix(fileCopy.Link, "http") {
|
||||
links = append(links, fileCopy.Link)
|
||||
}
|
||||
fileCopy.Link = "" // empty the links = chaos!
|
||||
@@ -619,7 +619,7 @@ func (t *TorrentManager) Repair(accessKey string) {
|
||||
// if all the selected files are missing but there are other streamable files
|
||||
var missingFiles []File
|
||||
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
if file.Link == "" {
|
||||
if !strings.HasPrefix(file.Link, "http") {
|
||||
missingFiles = append(missingFiles, *file)
|
||||
}
|
||||
})
|
||||
@@ -643,7 +643,7 @@ func (t *TorrentManager) reinsertTorrent(torrent *Torrent, missingFiles string)
|
||||
if missingFiles == "" {
|
||||
tmpSelection := ""
|
||||
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
|
||||
if file.Link == "" {
|
||||
if !strings.HasPrefix(file.Link, "http") {
|
||||
tmpSelection += fmt.Sprintf("%d,", file.ID)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user