From 03fd0a36a634da05793203bb5d55fe33c0769c29 Mon Sep 17 00:00:00 2001 From: ngosang Date: Sun, 19 Jul 2015 14:04:48 +0200 Subject: [PATCH] [Web UI] Torrent download from hash. Closes #1173 --- src/webui/webapplication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 14f6136ea..bd3178f0e 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -315,6 +315,9 @@ void WebApplication::action_command_download() foreach (QString url, list) { url = url.trimmed(); if (!url.isEmpty()) { + 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; if (url.startsWith("bc://bt/", Qt::CaseInsensitive)) { qDebug("Converting bc link to magnet link"); url = misc::bcLinkToMagnet(url);