From f0d32e2cde75d1b17451360b827f5e8dd6e1f204 Mon Sep 17 00:00:00 2001 From: ngosang Date: Thu, 9 Jul 2015 09:59:34 +0200 Subject: [PATCH] [Web UI] Torrent download from hash. Closes #1173 --- src/webui/webapplication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 89c553135..23530e5b6 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -313,7 +313,9 @@ void WebApplication::action_command_download() qDebug("Converting bc link to magnet link"); url = Utils::Misc::bcLinkToMagnet(url); } - + if ((url.size() == 40 && !url.contains(QRegExp("[^0-9A-Fa-f]"))) + || (url.size() == 32 && !url.contains(QRegExp("[^2-7A-Za-z]")))) + url = "magnet:?xt=urn:btih:" + url; BitTorrent::Session::instance()->addTorrent(url); } }