1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-11-27 04:34:45 +01:00

SFTP: Fix bug whereby sometimes download amount would be ignored

This commit is contained in:
terrafrost 2013-02-27 22:10:33 -06:00
parent eb860d275e
commit 1d1c2782e9

View File

@ -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);
}