diff --git a/models/torrent.go b/models/torrent.go index e5237bdf..e68ed7d0 100644 --- a/models/torrent.go +++ b/models/torrent.go @@ -216,6 +216,14 @@ func (t *Torrent) ParseTrackers(trackers []string) { } } } + tempTrackers := []string{} + for _, line := range trackers { + if !contains(tempTrackers, line) { + tempTrackers = append(tempTrackers, line) + } + } + trackers = tempTrackers + v["tr"] = trackers t.Trackers = v.Encode() } @@ -517,3 +525,12 @@ func (t *Torrent) DeleteTags() { log.CheckErrorWithMessage(err, "LOAD_TAGS_ERROR: Couldn't delete tags!") } } + +func contains(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +}