summaryrefslogtreecommitdiff
path: root/src/FtpNegotiationCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-06-04 21:45:12 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-06-04 21:45:12 +0900
commit4f3c526dcdf5fce74dd12be1c882f6c47d1829ec (patch)
tree9e67f3032b6de4be1cf915fd86b439eea6521314 /src/FtpNegotiationCommand.cc
parentadeead6f0396e2f8551d1182972e277728fd6c8b (diff)
Support PREF_DIR change for Metalink files
Reworked previous commit adeead6f0396e2f8551d1182972e277728fd6c8b, and now support changing PREF_DIR for Metalink downloads.
Diffstat (limited to 'src/FtpNegotiationCommand.cc')
-rw-r--r--src/FtpNegotiationCommand.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc
index 16237fe0..062db5e7 100644
--- a/src/FtpNegotiationCommand.cc
+++ b/src/FtpNegotiationCommand.cc
@@ -361,11 +361,13 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
{
getFileEntry()->setLength(totalLength);
if(getFileEntry()->getPath().empty()) {
+ auto suffixPath = util::createSafePath
+ (util::percentDecode(std::begin(getRequest()->getFile()),
+ std::end(getRequest()->getFile())));
+
getFileEntry()->setPath
- (util::createSafePath
- (getOption()->get(PREF_DIR),
- util::percentDecode(getRequest()->getFile().begin(),
- getRequest()->getFile().end())));
+ (util::applyDir(getOption()->get(PREF_DIR), suffixPath));
+ getFileEntry()->setSuffixPath(suffixPath);
}
getRequestGroup()->preDownloadProcessing();
if(totalLength == 0) {