Replace "/" with "-" in magnet dn name when used as in-memory download name

pull/722/head
Tatsuhiro Tsujikawa 2016-08-01 22:25:03 +09:00
parent 829a3552fd
commit 48310915ee
1 changed files with 5 additions and 1 deletions

View File

@ -249,7 +249,11 @@ createBtMagnetRequestGroup(const std::string& magnetLink,
bittorrent::loadMagnet(magnetLink, dctx);
auto torrentAttrs = bittorrent::getTorrentAttrs(dctx);
bittorrent::adjustAnnounceUri(torrentAttrs, option);
dctx->getFirstFileEntry()->setPath(torrentAttrs->name);
// torrentAttrs->name may contain "/", but we use basename of
// FileEntry::getPath() to print out in-memory download entry.
// Since "/" is treated as separator, we replace it with "-".
dctx->getFirstFileEntry()->setPath(
util::replace(torrentAttrs->name, "/", "-"));
rg->setDownloadContext(dctx);
rg->clearPostDownloadHandler();
rg->addPostDownloadHandler(