mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
SFTP: Fix bug whereby sometimes download amount would be ignored
This commit is contained in:
parent
eb860d275e
commit
1d1c2782e9
@ -1681,15 +1681,18 @@ class Net_SFTP extends Net_SSH2 {
|
||||
}
|
||||
|
||||
if ($length > 0 && $length <= $offset - $size) {
|
||||
if ($local_file === false) {
|
||||
$content = substr($content, 0, $length);
|
||||
} else {
|
||||
ftruncate($fp, $length);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($length > 0 && $length <= strlen($content)) {
|
||||
if ($local_file === false) {
|
||||
$content = substr($content, 0, $length);
|
||||
} else {
|
||||
ftruncate($fp, $length);
|
||||
}
|
||||
}
|
||||
|
||||
if ($local_file !== false) {
|
||||
fclose($fp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user