Commit 8a04e100 authored by Harald Sitter's avatar Harald Sitter 🏳🌈
Browse files

sftp: fix partial transfer resuming when copying to local

the previous condition checked if the final target path size was >0,
which it would only be when the file already exists (i.e. overwrite) in
all other scenarios it would always be false and as such resuming wouldn't
work. what we actually want to check is whether the part file is >0 (i.e.
there's actual pending bytes to resume from).

this makes resuming work when copying remote->local

CCBUG: 417645

Test Plan:
- create file of suitably large size (1g)
- `split -b somesize` the file into two segments
- copy first segment to /tmp/file.part
- connect to /tmp over sftp and copy the file there
- progress starts at 50% and resulting file is same as input file

Reviewers: ngraham, feverfew, bruns

Subscribers: bruns, kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision:
parent b13449a1
......@@ -1932,11 +1932,13 @@ Result SFTPInternal::sftpCopyGet(const QUrl &url, const QString &sCopyFile, int
const bool bMarkPartial = q->configValue(QStringLiteral("MarkPartial"), true);
const QString dest = (bMarkPartial ? sPart : sCopyFile);
if (bMarkPartial && bPartExists && copyFile.size() > 0) {
if (bMarkPartial && bPartExists) {
if (partFile.isDir()) {
return Result::fail(ERR_FILE_ALREADY_EXIST, sCopyFile);
bResume = q->canResume(copyFile.size());
if (partFile.size() > 0) {
bResume = q->canResume(copyFile.size());
if (bPartExists && !bResume) // get rid of an unwanted ".part" file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment