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.
This commit is contained in:
Vincent Petry 2013-11-20 14:33:59 +01:00
parent 8bc339413b
commit 726a202cdb
1 changed files with 5 additions and 3 deletions

View File

@ -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)) {