Clean up grouping logic
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package dav
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -17,8 +16,6 @@ func Router(mux *http.ServeMux) {
|
||||
log.Panicf("Config failed to load: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("config version", c.GetDirectories())
|
||||
|
||||
t := torrent.NewTorrentManager(os.Getenv("RD_TOKEN"), c)
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -23,9 +23,9 @@ func findAllTorrentsWithName(t *torrent.TorrentManager, directory, torrentName s
|
||||
var matchingTorrents []torrent.Torrent
|
||||
|
||||
torrents := t.GetByDirectory(directory)
|
||||
for _, torrent := range torrents {
|
||||
if torrent.Name == torrentName || strings.HasPrefix(torrent.Name, torrentName) {
|
||||
matchingTorrents = append(matchingTorrents, torrent)
|
||||
for i := range torrents {
|
||||
if torrents[i].Name == torrentName || strings.HasPrefix(torrents[i].Name, torrentName) {
|
||||
matchingTorrents = append(matchingTorrents, torrents[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user