Browse Source

Fix downloaded metaurl torrent filename

Tatsuhiro Tsujikawa 9 năm trước cách đây
mục cha
commit
3c637fa3d5

+ 1 - 0
src/Metalink2RequestGroup.cc

@@ -228,6 +228,7 @@ void Metalink2RequestGroup::createRequestGroup(
         // make it in-memory download
         // make it in-memory download
         torrentRg->addPreDownloadHandler(
         torrentRg->addPreDownloadHandler(
             download_handlers::getMemoryPreDownloadHandler());
             download_handlers::getMemoryPreDownloadHandler());
+        torrentRg->markInMemoryDownload();
         groups.push_back(torrentRg);
         groups.push_back(torrentRg);
       }
       }
     }
     }

+ 3 - 1
src/RequestGroup.cc

@@ -1148,7 +1148,9 @@ std::shared_ptr<DownloadResult> RequestGroup::createDownloadResult() const
 void RequestGroup::reportDownloadFinished()
 void RequestGroup::reportDownloadFinished()
 {
 {
   A2_LOG_NOTICE(fmt(MSG_FILE_DOWNLOAD_COMPLETED,
   A2_LOG_NOTICE(fmt(MSG_FILE_DOWNLOAD_COMPLETED,
-                    downloadContext_->getBasePath().c_str()));
+                    inMemoryDownload()
+                        ? getFirstFilePath().c_str()
+                        : downloadContext_->getBasePath().c_str()));
   uriSelector_->resetCounters();
   uriSelector_->resetCounters();
 #ifdef ENABLE_BITTORRENT
 #ifdef ENABLE_BITTORRENT
   if (downloadContext_->hasAttribute(CTX_ATTR_BT)) {
   if (downloadContext_->hasAttribute(CTX_ATTR_BT)) {