From: Matt Joiner Date: Sat, 16 Feb 2019 07:33:14 +0000 (+1100) Subject: Torrent.String: Quote raw names X-Git-Tag: v1.1.0~13 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9ea65d672f5a6e5d499f01d4503d3402852b5ceb;p=btrtrc.git Torrent.String: Quote raw names --- diff --git a/t.go b/t.go index 8af13dc2..452a717a 100644 --- a/t.go +++ b/t.go @@ -1,6 +1,7 @@ package torrent import ( + "strconv" "strings" "github.com/anacrolix/missinggo/pubsub" @@ -221,9 +222,10 @@ func (t *Torrent) DownloadAll() { func (t *Torrent) String() string { s := t.name() if s == "" { - s = t.infoHash.HexString() + return t.infoHash.HexString() + } else { + return strconv.Quote(s) } - return s } func (t *Torrent) AddTrackers(announceList [][]string) {