using the number of writen bytes as indicator if streamCopy() was successfully. Instead check if fwrite returns the number of bytes or false
This commit is contained in:
parent
51d050c935
commit
5b94959686
|
@ -361,10 +361,9 @@ class View {
|
||||||
} else {
|
} else {
|
||||||
$source = $this->fopen($path1 . $postFix1, 'r');
|
$source = $this->fopen($path1 . $postFix1, 'r');
|
||||||
$target = $this->fopen($path2 . $postFix2, 'w');
|
$target = $this->fopen($path2 . $postFix2, 'w');
|
||||||
$count = \OC_Helper::streamCopy($source, $target);
|
$result = \OC_Helper::streamCopy($source, $target);
|
||||||
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
|
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
|
||||||
$storage1->unlink($internalPath1);
|
$storage1->unlink($internalPath1);
|
||||||
$result = $count > 0;
|
|
||||||
}
|
}
|
||||||
if ($this->fakeRoot == Filesystem::getRoot()) {
|
if ($this->fakeRoot == Filesystem::getRoot()) {
|
||||||
\OC_Hook::emit(
|
\OC_Hook::emit(
|
||||||
|
|
|
@ -513,11 +513,13 @@ class OC_Helper {
|
||||||
if(!$source or !$target) {
|
if(!$source or !$target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$count=0;
|
$result=true;
|
||||||
while(!feof($source)) {
|
while(!feof($source)) {
|
||||||
$count+=fwrite($target, fread($source, 8192));
|
if (fwrite($target, fread($source, 8192)) === false) {
|
||||||
|
$result = false;
|
||||||
}
|
}
|
||||||
return $count;
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue