summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-14 22:32:39 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-14 22:32:39 +0200
commit0a7aa6e8cdbf96c3a54ea0a897eb5dfb8cd37c01 (patch)
tree44b48baca04e6d0daaa444c4213dc4c66adc41ff
parent84c56a5d56eddfb9e5d0356575902253eb266da1 (diff)
downloadnextcloud-server-0a7aa6e8cdbf96c3a54ea0a897eb5dfb8cd37c01.tar.gz
nextcloud-server-0a7aa6e8cdbf96c3a54ea0a897eb5dfb8cd37c01.zip
fix for Allowed memory size of xx bytes exhausted while reading big files
-rw-r--r--apps/files_encryption/lib/util.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 0233804160d..19c9cd72a19 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -480,13 +480,20 @@ class Util {
*/
public function isEncryptedPath( $path ) {
- // Disable encryption proxy so data retreived is in its
+ // Disable encryption proxy so data retrieved is in its
// original form
+ $proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
-
- $data = $this->view->file_get_contents( $path );
-
- \OC_FileProxy::$enabled = true;
+
+ // we only need 24 byte from the last chunk
+ $data = '';
+ $handle = $this->view->fopen( $path, 'r' );
+ if(!fseek($handle, -24, SEEK_END)) {
+ $data = fgets($handle);
+ }
+
+ // re-enable proxy
+ \OC_FileProxy::$enabled = $proxyStatus;
return Crypt::isCatfileContent( $data );