diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-09-17 17:21:42 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-09-17 17:21:42 +0900 |
| commit | a31e73d902d9e08df1a29556b81f52469b9353f2 (patch) | |
| tree | f34e5c77684f9e4fc7c98fcbcf69acb064017932 | |
| parent | 561d49d6e530eb4ea4499f5bd7ce80416ff79738 (diff) | |
Fix bug that file name is not logged with --conditional-get
| -rw-r--r-- | src/HttpResponseCommand.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 4765f647..18972575 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -184,6 +184,19 @@ bool HttpResponseCommand::executeInternal() getPieceStorage()->markAllPiecesDone(); // Just set checksum verification done. ctx->setChecksumVerified(true); + + if (fe->getPath().empty()) { + // If path is empty, set default file name or file portion of + // URI. This is the file we used to get modified date. + auto& file = getRequest()->getFile(); + auto suffixPath = util::createSafePath( + getRequest()->getFile().empty() + ? Request::DEFAULT_FILE + : util::percentDecode(std::begin(file), std::end(file))); + fe->setPath(util::applyDir(getOption()->get(PREF_DIR), suffixPath)); + fe->setSuffixPath(suffixPath); + } + A2_LOG_NOTICE(fmt(MSG_DOWNLOAD_ALREADY_COMPLETED, GroupId::toHex(grp->getGID()).c_str(), grp->getFirstFilePath().c_str())); |
