Allow to retain repair status and unselect status
This commit is contained in:
@@ -143,7 +143,7 @@ func (t *TorrentManager) mergeToMain(mainTorrent, torrentToMerge *Torrent) *Torr
|
||||
// Merge SelectedFiles - itercb accesses a different copy of the selectedfiles map
|
||||
torrentToMerge.SelectedFiles.IterCb(func(filepath string, fileToMerge *File) {
|
||||
// see if it already exists in the main torrent
|
||||
if mainFile, ok := mainTorrent.SelectedFiles.Get(filepath); !ok {
|
||||
if _, ok := mainTorrent.SelectedFiles.Get(filepath); !ok {
|
||||
// if it doesn't exist in the main torrent, add it
|
||||
mainTorrent.SelectedFiles.Set(filepath, fileToMerge)
|
||||
} else {
|
||||
@@ -151,9 +151,6 @@ func (t *TorrentManager) mergeToMain(mainTorrent, torrentToMerge *Torrent) *Torr
|
||||
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 !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)
|
||||
}
|
||||
// else do nothing, the main torrent's file is more recent or has a valid link
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user