]> source.dussan.org Git - nextcloud-server.git/commitdiff
using the number of writen bytes as indicator if streamCopy() was successfully. Inste...
authorBjörn Schießle <schiessle@owncloud.com>
Fri, 22 Feb 2013 13:56:50 +0000 (14:56 +0100)
committerBjörn Schießle <schiessle@owncloud.com>
Fri, 22 Feb 2013 13:56:50 +0000 (14:56 +0100)
lib/files/view.php
lib/helper.php

index 9ac08c98082d1251c2d01df1628d5562dd8f5086..11edbadab9bc8b4c019634b32feaa96a8ec7e7da 100644 (file)
@@ -361,10 +361,9 @@ class View {
                                } else {
                                        $source = $this->fopen($path1 . $postFix1, 'r');
                                        $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);
                                        $storage1->unlink($internalPath1);
-                                       $result = $count > 0;
                                }
                                if ($this->fakeRoot == Filesystem::getRoot()) {
                                        \OC_Hook::emit(
index add5c66e7bee236c9f4546ffdc944172431bf192..2c9cd36b1996c8f2045036c6a94afe5f7340059a 100644 (file)
@@ -513,11 +513,13 @@ class OC_Helper {
                if(!$source or !$target) {
                        return false;
                }
-               $count=0;
+               $result=true;
                while(!feof($source)) {
-                       $count+=fwrite($target, fread($source, 8192));
+                       if (fwrite($target, fread($source, 8192)) === false) {
+                               $result = false;
+                       }
                }
-               return $count;
+               return $result;
        }
 
        /**