diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index db7d2ad61739ae3ab83b8d03abac1d222e5a94e5..ab967835082203b5a0845ecc36d4c0f05d0da674 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -509,15 +509,15 @@ class Stream {
             // Save the sharekeys
             Keymanager::setShareKeys( $view, $this->relPath, $this->encKeyfiles['keys'] );
 
-            // Re-enable proxy - our work is done
-            \OC_FileProxy::$enabled = $proxyStatus;
-
             // get file info
             $fileInfo = $view->getFileInfo($this->rawPath);
             if(!is_array($fileInfo)) {
                 $fileInfo = array();
             }
 
+            // Re-enable proxy - our work is done
+            \OC_FileProxy::$enabled = $proxyStatus;
+
             // set encryption data
             $fileInfo['encrypted'] = true;
             $fileInfo['size'] = $this->size;