diff --git a/src/download_helper.cc b/src/download_helper.cc index ad1bf648..42b96513 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -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(