From 867709e5a3ebb3d2af15300ced80576638002bd6 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Mon, 9 Aug 2021 08:24:21 +0300 Subject: [PATCH] prefer dn over name with empty title --- server/web/api/torrents.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/web/api/torrents.go b/server/web/api/torrents.go index b15b0d3..cc11669 100644 --- a/server/web/api/torrents.go +++ b/server/web/api/torrents.go @@ -71,7 +71,7 @@ func addTorrent(req torrReqJS, c *gin.Context) { req.Link = strings.ReplaceAll(req.Link, "&", "&") torrSpec, err := utils.ParseLink(req.Link) if err != nil { - log.TLogln("error add torrent:", err) + log.TLogln("error parse link:", err) c.AbortWithError(http.StatusBadRequest, err) return } @@ -85,12 +85,15 @@ func addTorrent(req torrReqJS, c *gin.Context) { go func() { if !tor.GotInfo() { - log.TLogln("error add torrent:", "timeout connection torrent") + log.TLogln("error add torrent:", "timeout connection get torrent info") return } if tor.Title == "" { - tor.Title = tor.Name() + tor.Title = torrSpec.DisplayName // prefer dn over name + if tor.Title == "" { + tor.Title = tor.Name() + } } if req.SaveToDB {