[Pkg-owncloud-commits] [owncloud] 94/111: Fixed getLocalFile() condition for x-send-file

David Prévot taffit at moszumanska.debian.org
Wed Nov 20 21:38:46 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 726a202cdb9471a0bc4c6c27e59469af1e39a32e
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Wed Nov 20 14:33:59 2013 +0100

    Fixed getLocalFile() condition for x-send-file
    
    Until now, addSendfileHeader() was called even when no x-send-file
    headers were set. Even though the method itself doesn't do anything,
    a call to getLocalFile() was done and would trigger a full download
    when using external storage.
    
    Additionally, the storage resolution code is wrong and always
    returns the local storage of the root filesystem, which caused the code to
    be run anyway.
    
    This commit fixes both issues.
---
 lib/private/files.php |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/private/files.php b/lib/private/files.php
index 8b4d5c5..e76dd86 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -131,9 +131,11 @@ class OC_Files {
 				if ($filesize > -1) {
 					header("Content-Length: ".$filesize);
 				}
-				list($storage) = \OC\Files\Filesystem::resolvePath($filename);
-				if ($storage instanceof \OC\Files\Storage\Local) {
-					self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
+				if ($xsendfile) {
+					list($storage) = \OC\Files\Filesystem::resolvePath(\OC\Files\Filesystem::getView()->getAbsolutePath($filename));
+					if ($storage instanceof \OC\Files\Storage\Local) {
+						self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
+					}
 				}
 			}
 		} elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list