diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-04-10 10:42:04 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-04-10 10:42:04 +0200 |
commit | 8d05848391fc87f20d11176082820a91031a2b34 (patch) | |
tree | ddeadffdf6b67cecf3e28a835680fe5066ce4ebb /lib | |
parent | 9a8457aca0290b62e62575c59ba6b189c31b9b81 (diff) | |
parent | 1c7a71ca779af16059dd00dbe3dd79097c556ad4 (diff) | |
download | nextcloud-server-8d05848391fc87f20d11176082820a91031a2b34.tar.gz nextcloud-server-8d05848391fc87f20d11176082820a91031a2b34.zip |
Merge pull request #7825 from owncloud/hash-stream
Use streams when generating hashes of remote files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/storage/common.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 0ce447a5a48..33b8549ff78 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -159,9 +159,11 @@ abstract class Common implements \OC\Files\Storage\Storage { } public function hash($type, $path, $raw = false) { - $tmpFile = $this->getLocalFile($path); - $hash = hash_file($type, $tmpFile, $raw); - return $hash; + $fh = $this->fopen($path, 'rb'); + $ctx = hash_init($type); + hash_update_stream($ctx, $fh); + fclose($fh); + return hash_final($ctx, $raw); } public function search($query) { |