util/dirwatch/dirwatch.go | 5 +++-- diff --git a/util/dirwatch/dirwatch.go b/util/dirwatch/dirwatch.go index afc7653d76c66c99aba70459d9d7f2b697826e20..1e857e1ad6ce2510ffbc4270d2389a6af84c4187 100644 --- a/util/dirwatch/dirwatch.go +++ b/util/dirwatch/dirwatch.go @@ -90,7 +90,7 @@ ee = make(map[torrent.InfoHash]entity, len(names)) addEntity := func(e entity) { e0, ok := ee[e.InfoHash] if ok { - if e0.MagnetURI != "" && len(e.MagnetURI) < len(e0.MagnetURI) { + if e0.MagnetURI == "" || len(e.MagnetURI) < len(e0.MagnetURI) { return } } @@ -107,7 +107,7 @@ } e := entity{ TorrentFilePath: fullName, } - util.CopyExact(e.InfoHash, ih) + util.CopyExact(&e.InfoHash, ih) addEntity(e) case ".magnet": uris, err := magnetFileURIs(fullName) @@ -138,6 +138,7 @@ return } defer f.Close() scanner := bufio.NewScanner(f) + scanner.Split(bufio.ScanWords) for scanner.Scan() { uris = append(uris, scanner.Text()) }