Skip to content

Commit

Permalink
Fix bug that file name is not logged with --conditional-get
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Sep 17, 2016
1 parent 561d49d commit a31e73d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/HttpResponseCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit a31e73d

Please sign in to comment.