[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Blibktorrent/1=2E1=5D_src/magnet=3A_Allow_a_dash-sep?=
From:       Christian Weilbach <christian_weilbach () web ! de>
Date:       2011-03-02 5:21:02
Message-ID: 20110302052102.CF571A60C9 () git ! kde ! org
[Download RAW message or body]

Git commit 2785882041803c8c230bb78d26f195ff72cc4d5b by Christian Weilbach.
Committed on 02/03/2011 at 06:19.
Pushed by weilbach into branch '1.1'.

Allow a dash-seperated list for hashes later on, which at least won't break the current code. Backport.

M  +2    -1    src/magnet/magnetlink.cpp     

http://commits.kde.org/libktorrent/2785882041803c8c230bb78d26f195ff72cc4d5b

diff --git a/src/magnet/magnetlink.cpp b/src/magnet/magnetlink.cpp
index 0652139..765ed65 100644
--- a/src/magnet/magnetlink.cpp
+++ b/src/magnet/magnetlink.cpp
@@ -88,7 +88,8 @@ namespace bt
 		     || !xt.startsWith("urn:btih:") ) {
 			QRegExp btihHash("([^\\.]+).btih");
 			if ( btihHash.indexIn(url.host()) != -1 ) {
-				xt = "urn:btih:"+btihHash.cap(1);
+				QString primaryHash = btihHash.cap(1).split("-")[0];
+				xt = "urn:btih:"+primaryHash;
 			} else {
 				Out(SYS_GEN|LOG_NOTICE) << "Invalid magnet link " << mlink << endl;
 				return;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic