core: fix magnet link encoding. resolves #8889 (#9020)

This commit is contained in:
Diego Heras
2020-06-21 09:13:22 +02:00
committed by GitHub
parent d3b79e4eb1
commit 878aa1aab9

View File

@@ -66,12 +66,8 @@ namespace Jackett.Server.Controllers
&& downloadBytes[6] == 0x3a // :
)
{
// some sites provide magnet links with non-ascii characters, the only way to be sure the url
// is well encoded is to unscape and escape again
// https://github.com/Jackett/Jackett/issues/5372
// https://github.com/Jackett/Jackett/issues/4761
var magneturi = Uri.EscapeUriString(Uri.UnescapeDataString(Encoding.UTF8.GetString(downloadBytes)));
return Redirect(magneturi);
var magnetUrl = Encoding.UTF8.GetString(downloadBytes);
return Redirect(magnetUrl);
}
// This will fix torrents where the keys are not sorted, and thereby not supported by Sonarr.