From 7426efd423702a38daf42de6695d061bae2a273c Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 2 Oct 2015 14:35:09 +0200 Subject: [PATCH] rTorrent: Fixed label bug --- .../Download/Clients/rTorrent/RTorrentProxy.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs index 1ac0032d1..d16ea589a 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs @@ -97,11 +97,13 @@ namespace NzbDrone.Core.Download.Clients.RTorrent var items = new List(); foreach (object[] torrent in ret) { + var labelDecoded = System.Web.HttpUtility.UrlDecode((string) torrent[3]); + var item = new RTorrentTorrent(); item.Name = (string) torrent[0]; item.Hash = (string) torrent[1]; item.Path = (string) torrent[2]; - item.Category = (string) torrent[3]; + item.Category = labelDecoded; item.TotalSize = (long) torrent[4]; item.RemainingSize = (long) torrent[5]; item.DownRate = (long) torrent[6]; @@ -172,10 +174,12 @@ namespace NzbDrone.Core.Download.Clients.RTorrent { _logger.Debug("Executing remote method: d.set_custom1"); + var labelEncoded = System.Web.HttpUtility.UrlEncode(label); + var client = BuildClient(settings); - var setLabel = client.SetLabel(hash, label); - if (setLabel != label) + var setLabel = client.SetLabel(hash, labelEncoded); + if (setLabel != labelEncoded) { throw new DownloadClientException("Could set label on torrent: {0}.", hash); }