Skip to content
Snippets Groups Projects
Commit 726a202c authored by Vincent Petry's avatar Vincent Petry
Browse files

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.
parent 8bc33941
No related branches found
No related tags found
No related merge requests found
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment