From da3422e55c7274fccc26c850fca0261682ecde36 Mon Sep 17 00:00:00 2001 From: antanilol <93981288+antanilol@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:49:56 +0100 Subject: [PATCH] Add eXact Length parameter to magnet uri, solves #20752 --- src/base/bittorrent/torrentimpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 5a2b6aac9..dd320b69d 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -2863,6 +2863,11 @@ QString TorrentImpl::createMagnetURI() const ret += u"&dn=" + QString::fromLatin1(QUrl::toPercentEncoding(displayName)); } + if (hasMetadata()) + { + ret += u"&xl=" + QString::number(totalSize()); + } + for (const TrackerEntryStatus &tracker : asConst(trackers())) { ret += u"&tr=" + QString::fromLatin1(QUrl::toPercentEncoding(tracker.url));